mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-10-09 16:00:29 +00:00
Compare commits
640
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0be45b6a55 | ||
|
|
c922615183 | ||
|
|
8b2990fca4 | ||
|
|
37b5cd743a | ||
|
|
3b1324db08 | ||
|
|
f56bbb7dc1 | ||
|
|
cff649ae95 | ||
|
|
cb87ca4361 | ||
|
|
165d2b1290 | ||
|
|
189555e16c | ||
|
|
2d8250926f | ||
|
|
47e343712e | ||
|
|
11ffb4f2be | ||
|
|
e7670f96de | ||
|
|
342c04b30a | ||
|
|
5ab8377ac1 | ||
|
|
74eb2c8dd6 | ||
|
|
f136d97941 | ||
|
|
a5629e3f42 | ||
|
|
515d6ca500 | ||
|
|
c0ccc0318d | ||
|
|
8196c11010 | ||
|
|
170bd22062 | ||
|
|
097a33c68f | ||
|
|
3be3bf9926 | ||
|
|
038f2b4f54 | ||
|
|
f84e284c20 | ||
|
|
48e75b5916 | ||
|
|
a12ceaee6e | ||
|
|
9050680115 | ||
|
|
0022a9b508 | ||
|
|
3437d62f31 | ||
|
|
dc880835d0 | ||
|
|
1663bf8677 | ||
|
|
aed236cbc9 | ||
|
|
90be74504e | ||
|
|
bba8aab18c | ||
|
|
47d135ecca | ||
|
|
d96fe49993 | ||
|
|
ac396b61ce | ||
|
|
6798d0c7ee | ||
|
|
1490ed7541 | ||
|
|
48b3032de6 | ||
|
|
ed12bec460 | ||
|
|
3c4a1ea614 | ||
|
|
79eb0288b4 | ||
|
|
99775e1eb4 | ||
|
|
db848b41d2 | ||
|
|
b5b11dff86 | ||
|
|
9cf4bfc606 | ||
|
|
221162d44f | ||
|
|
617970a1f8 | ||
|
|
5610c73d67 | ||
|
|
51fe02661f | ||
|
|
8f491b2933 | ||
|
|
b7e16bd6d5 | ||
|
|
38ca2ddd01 | ||
|
|
402b41100b | ||
|
|
766beae4e1 | ||
|
|
05f72e9dcf | ||
|
|
23553c68ae | ||
|
|
4dd1eb7a1e | ||
|
|
db307732c6 | ||
|
|
33d4ade1d4 | ||
|
|
186075ff9a | ||
|
|
34df745d1c | ||
|
|
ec363ac157 | ||
|
|
193b0f3cd4 | ||
|
|
67c1bf2924 | ||
|
|
b1373ff77e | ||
|
|
55d0e27212 | ||
|
|
1c052b7c13 | ||
|
|
6c8d48c2dc | ||
|
|
b61dae638b | ||
|
|
872a93aa07 | ||
|
|
b1f337020c | ||
|
|
56858dd74c | ||
|
|
358415f737 | ||
|
|
5e73260103 | ||
|
|
e169f46784 | ||
|
|
39416abd47 | ||
|
|
640a0ca815 | ||
|
|
8e54cd5162 | ||
|
|
0f0099accb | ||
|
|
718ebeb203 | ||
|
|
4101bf691d | ||
|
|
a97deb3dca | ||
|
|
10203d5c0c | ||
|
|
a357d6697d | ||
|
|
555b0aa999 | ||
|
|
6dd0dbe2c3 | ||
|
|
c31bbae768 | ||
|
|
2bb0f15973 | ||
|
|
be229551e3 | ||
|
|
6283eb4c69 | ||
|
|
c329fb6599 | ||
|
|
c3685f6b74 | ||
|
|
f4f5a36475 | ||
|
|
ea1261b48e | ||
|
|
0c68f16a66 | ||
|
|
33e5c9230f | ||
|
|
96eefab36f | ||
|
|
b0b6bf458f | ||
|
|
f3d85d1309 | ||
|
|
39385ea0a0 | ||
|
|
e492c6573c | ||
|
|
10a7fb3be2 | ||
|
|
8bc7cfade3 | ||
|
|
ea044d6c32 | ||
|
|
f6ee3dc75b | ||
|
|
367a74503f | ||
|
|
53b1a7af4c | ||
|
|
078d7fbe1e | ||
|
|
c709e48ceb | ||
|
|
0741f60896 | ||
|
|
af8eef4a91 | ||
|
|
f233ef7069 | ||
|
|
1c199bd3d7 | ||
|
|
036c973fec | ||
|
|
8bb225d272 | ||
|
|
ab932ae154 | ||
|
|
89f969ec6e | ||
|
|
afa8cf22b1 | ||
|
|
67aa8471dc | ||
|
|
0617b81b3b | ||
|
|
98c535a12c | ||
|
|
ec46518936 | ||
|
|
a7b034387f | ||
|
|
7905dd00a6 | ||
|
|
74583aa1aa | ||
|
|
4be9d71edf | ||
|
|
57bfc38eb8 | ||
|
|
aaaa5980b5 | ||
|
|
4f57dfc76e | ||
|
|
2c31ffc66b | ||
|
|
b104a13b71 | ||
|
|
28633d2fef | ||
|
|
9052386c83 | ||
|
|
7bc45f2d77 | ||
|
|
2ef6ecb951 | ||
|
|
ca0dc71338 | ||
|
|
04a1ec9a9a | ||
|
|
999e5a779a | ||
|
|
99f62b7230 | ||
|
|
4dee4e1cc2 | ||
|
|
539addc656 | ||
|
|
1a35b307fa | ||
|
|
a04f4a8b96 | ||
|
|
6b88e1adf2 | ||
|
|
99bc8177d4 | ||
|
|
cf2a1372f2 | ||
|
|
42c30f324a | ||
|
|
dab83fee20 | ||
|
|
6f3c5586fc | ||
|
|
aab8df6abc | ||
|
|
b9be79b05a | ||
|
|
ec3024f2c3 | ||
|
|
070f61e229 | ||
|
|
a82a4ebfc5 | ||
|
|
87009ddb27 | ||
|
|
3650ff27b3 | ||
|
|
6c08a3114a | ||
|
|
381cb61185 | ||
|
|
8d69da7702 | ||
|
|
8922395fdc | ||
|
|
83db40e261 | ||
|
|
95ec6c62ef | ||
|
|
56fc9ea428 | ||
|
|
88c6fc050b | ||
|
|
2392f91567 | ||
|
|
5f0c740eb0 | ||
|
|
120d0dd7c6 | ||
|
|
2844f6db7f | ||
|
|
570074f92d | ||
|
|
a13047c855 | ||
|
|
ca0d24bf56 | ||
|
|
2b18251360 | ||
|
|
f7c875acda | ||
|
|
a291a50c9f | ||
|
|
5bc7bc6aac | ||
|
|
9c376300ff | ||
|
|
5187b20252 | ||
|
|
fc401ffd8f | ||
|
|
667ee5256e | ||
|
|
f8356de93c | ||
|
|
55bb997d51 | ||
|
|
7c46f54e15 | ||
|
|
6dbb6d2247 | ||
|
|
9d0ae45edc | ||
|
|
b467dfa3b2 | ||
|
|
c13387bc70 | ||
|
|
41b2523750 | ||
|
|
afe82bd4be | ||
|
|
0f296fb70b | ||
|
|
d96ccd06a3 | ||
|
|
14095affa9 | ||
|
|
ed60565bc9 | ||
|
|
8313912c4f | ||
|
|
6274015d06 | ||
|
|
d195ce9155 | ||
|
|
cd0cd8a152 | ||
|
|
1f45ed6b06 | ||
|
|
7f6ad89edf | ||
|
|
5cdea288e2 | ||
|
|
e56feaf826 | ||
|
|
1288a09647 | ||
|
|
0cdaafa1c0 | ||
|
|
0b3334253c | ||
|
|
10f72f12d2 | ||
|
|
01643b2816 | ||
|
|
56e0da4fe3 | ||
|
|
144c397bf4 | ||
|
|
e06541984f | ||
|
|
ea7e92db84 | ||
|
|
8d48640c1d | ||
|
|
cfe5cb4b6b | ||
|
|
05c4d7dd38 | ||
|
|
13c6e0df99 | ||
|
|
dafd6ba71e | ||
|
|
2751c37716 | ||
|
|
50c01762e7 | ||
|
|
a77ebd3eb6 | ||
|
|
d84f0b5597 | ||
|
|
a3cdf87ea2 | ||
|
|
8ab3c16b3d | ||
|
|
18e943fd06 | ||
|
|
3b7a067dda | ||
|
|
4636ba815b | ||
|
|
317fad2a28 | ||
|
|
0ae28a1dd9 | ||
|
|
bbfe5f1d96 | ||
|
|
b713f20b66 | ||
|
|
3eb7a5adc5 | ||
|
|
956af78749 | ||
|
|
69ad01687e | ||
|
|
e83d07e88e | ||
|
|
6683696032 | ||
|
|
3396a5ffea | ||
|
|
18a14d3b75 | ||
|
|
2b13352004 | ||
|
|
94e5d7e642 | ||
|
|
001b4dbada | ||
|
|
1192dec689 | ||
|
|
956d47f9da | ||
|
|
063a071228 | ||
|
|
c54a7de827 | ||
|
|
0410e48aad | ||
|
|
a4d95737d3 | ||
|
|
bc64d83ab2 | ||
|
|
87616e388b | ||
|
|
3f35f90fc2 | ||
|
|
c3ba69814c | ||
|
|
66a517e58d | ||
|
|
3108c927af | ||
|
|
5738cceac9 | ||
|
|
db2f648bce | ||
|
|
6012a6cf9f | ||
|
|
a4dcbc90e6 | ||
|
|
955ecce952 | ||
|
|
91fba21ed3 | ||
|
|
490e2934b8 | ||
|
|
cb6d3d4fc3 | ||
|
|
7f2a09eab3 | ||
|
|
c522a308b9 | ||
|
|
dde686d55f | ||
|
|
2f0b4888de | ||
|
|
35e7b11709 | ||
|
|
6cf3f158c7 | ||
|
|
4944e705dc | ||
|
|
3b38b9d86b | ||
|
|
6275eec918 | ||
|
|
ad652ca6f5 | ||
|
|
7029d985c6 | ||
|
|
9539fd40eb | ||
|
|
4c03a482bd | ||
|
|
f58ed5614e | ||
|
|
198e78e0b4 | ||
|
|
1f16e09daa | ||
|
|
16f47f8664 | ||
|
|
40604c7880 | ||
|
|
fa86c4f39a | ||
|
|
7f3cc784cd | ||
|
|
836f6c3520 | ||
|
|
2ff1e3a245 | ||
|
|
f7078a6140 | ||
|
|
141786e4e9 | ||
|
|
2d098f8078 | ||
|
|
229254e3d3 | ||
|
|
96329967ba | ||
|
|
0d988bbd6a | ||
|
|
1ff4f33ceb | ||
|
|
c95d61397d | ||
|
|
590238dc13 | ||
|
|
ed1b2613f2 | ||
|
|
c0e0db670c | ||
|
|
9132a2c4a9 | ||
|
|
5e880ba25e | ||
|
|
5a1928bee6 | ||
|
|
82e9e72c70 | ||
|
|
c35f55f70c | ||
|
|
0542b39373 | ||
|
|
013cf21863 | ||
|
|
c648f9b14a | ||
|
|
d9407c425f | ||
|
|
2c8dad980b | ||
|
|
75d94f5b89 | ||
|
|
4d760d3019 | ||
|
|
20c9230291 | ||
|
|
02c3a34f13 | ||
|
|
c2dadc2b92 | ||
|
|
f5de005ad7 | ||
|
|
335a82332f | ||
|
|
a81cb5c1ab | ||
|
|
aaf1d86a55 | ||
|
|
cbad4dd172 | ||
|
|
932da58759 | ||
|
|
01defdf0f6 | ||
|
|
b33cce3059 | ||
|
|
17ef66aa49 | ||
|
|
f01d770fec | ||
|
|
06cc7fcc02 | ||
|
|
4635047004 | ||
|
|
88b70eba53 | ||
|
|
6ad48250f8 | ||
|
|
9ac9f76a1d | ||
|
|
b7702daea3 | ||
|
|
db7180a761 | ||
|
|
dbe62082ff | ||
|
|
06bf2bbc2f | ||
|
|
162a0c543c | ||
|
|
2bc07c91df | ||
|
|
3d84a5589f | ||
|
|
b88438a0a3 | ||
|
|
b73dcc9388 | ||
|
|
12ad08a619 | ||
|
|
0c000a4994 | ||
|
|
d2da7e2ea5 | ||
|
|
873bba92db | ||
|
|
3e14186d3d | ||
|
|
5be325405d | ||
|
|
5b92b75090 | ||
|
|
7202de6f4c | ||
|
|
e6a772ebfd | ||
|
|
f320492164 | ||
|
|
d8fd430856 | ||
|
|
8e3a06b07f | ||
|
|
b6f65f278d | ||
|
|
3e8dfb6841 | ||
|
|
ffeb47eaac | ||
|
|
4cffe1d6bc | ||
|
|
49b3b6ded5 | ||
|
|
f294130746 | ||
|
|
1910f1b78a | ||
|
|
cc1d2f1eae | ||
|
|
048121a936 | ||
|
|
e41e74d730 | ||
|
|
0ef1a26e95 | ||
|
|
00701a3999 | ||
|
|
8453e60609 | ||
|
|
d139073948 | ||
|
|
f6e6f9cbfb | ||
|
|
66e4af2be5 | ||
|
|
7327ee3ff8 | ||
|
|
23087bdb6f | ||
|
|
5e9a69d8f3 | ||
|
|
3e96e83c3c | ||
|
|
83ce744fb2 | ||
|
|
ae03b85a97 | ||
|
|
53e91a87b0 | ||
|
|
519c6bca66 | ||
|
|
f7dcacab92 | ||
|
|
00c6466423 | ||
|
|
b8d8867ebb | ||
|
|
7b1d746ce7 | ||
|
|
7dc0a2f664 | ||
|
|
52f7df0350 | ||
|
|
38d1cac5d9 | ||
|
|
c3565f72c4 | ||
|
|
7fdb0a5078 | ||
|
|
ce30a7d5cd | ||
|
|
28597721f2 | ||
|
|
c2fd02ac48 | ||
|
|
a8aa1f87f2 | ||
|
|
2ba17d89ef | ||
|
|
aaae8a5d3b | ||
|
|
5ca91157ca | ||
|
|
bad1b0b105 | ||
|
|
d14a149c57 | ||
|
|
9c6c77615e | ||
|
|
913e64bb75 | ||
|
|
fd8ef545e8 | ||
|
|
d068cc40f0 | ||
|
|
ee0e17a496 | ||
|
|
f1afc0f4d9 | ||
|
|
ea1afe7610 | ||
|
|
4ade175a3d | ||
|
|
c6ea06153a | ||
|
|
eb36a0f8cb | ||
|
|
3087c1a6e8 | ||
|
|
e5b0a1c591 | ||
|
|
af41e8e429 | ||
|
|
7e677ee9fa | ||
|
|
eea4cf68ad | ||
|
|
3a400dd15a | ||
|
|
fbbbd52d72 | ||
|
|
27664c7dce | ||
|
|
e1bdd215b1 | ||
|
|
d04a35565e | ||
|
|
7aad2cf4af | ||
|
|
bfa667584a | ||
|
|
1858cb4df8 | ||
|
|
dc30a3d1c3 | ||
|
|
6e690cc6f2 | ||
|
|
911b4076f5 | ||
|
|
4c01b1e542 | ||
|
|
ec372dbb98 | ||
|
|
0b87025c52 | ||
|
|
7d4230ecfb | ||
|
|
d06583773a | ||
|
|
67c1fbd07a | ||
|
|
5c7fab8f01 | ||
|
|
06554375cb | ||
|
|
e65329e7b3 | ||
|
|
f5435c581b | ||
|
|
5e8b23db6a | ||
|
|
f2849aa6ec | ||
|
|
ee947b6468 | ||
|
|
49c072b40d | ||
|
|
204f9f1fbc | ||
|
|
cccbaafd1b | ||
|
|
7bc06bb6b1 | ||
|
|
c16d5190c6 | ||
|
|
ffdd9b9d79 | ||
|
|
8d35c54672 | ||
|
|
eb0164907c | ||
|
|
478d44885c | ||
|
|
541bc456be | ||
|
|
5ce75992a3 | ||
|
|
c8b3ba7f6c | ||
|
|
d92ce86bb8 | ||
|
|
f7b4c8cd28 | ||
|
|
24c063b106 | ||
|
|
e478d2e624 | ||
|
|
dc0f726029 | ||
|
|
784b8da7af | ||
|
|
79e9dc9914 | ||
|
|
4849c6b42d | ||
|
|
024d142c8d | ||
|
|
126aea931c | ||
|
|
2372281d5e | ||
|
|
376d6609f2 | ||
|
|
96ab4c53af | ||
|
|
96cf46d834 | ||
|
|
208414704d | ||
|
|
7f453aa145 | ||
|
|
123997fa13 | ||
|
|
7faef2f8a7 | ||
|
|
f93cf3b996 | ||
|
|
df5b69756c | ||
|
|
745bb98abe | ||
|
|
cf1d02771f | ||
|
|
52377b0042 | ||
|
|
270501a237 | ||
|
|
2e5283b8d3 | ||
|
|
8cad47b29e | ||
|
|
2458d60d80 | ||
|
|
9a79dc4cdd | ||
|
|
e531b509d6 | ||
|
|
d287fc1186 | ||
|
|
f47f7c7361 | ||
|
|
7a6c99d57d | ||
|
|
5105114321 | ||
|
|
60beebcb4c | ||
|
|
fa03b4226a | ||
|
|
b047a053c5 | ||
|
|
42907cd228 | ||
|
|
425892cfc4 | ||
|
|
16fd804e93 | ||
|
|
2f147dde13 | ||
|
|
0d04f07f2a | ||
|
|
96485218b7 | ||
|
|
227cc57426 | ||
|
|
b99061777a | ||
|
|
8749dc649a | ||
|
|
65da51a478 | ||
|
|
0c31ba1c5f | ||
|
|
acf94b052b | ||
|
|
556441d811 | ||
|
|
efcf17e47c | ||
|
|
02b7744995 | ||
|
|
c86947b69c | ||
|
|
839b8c2844 | ||
|
|
e4a634e6e8 | ||
|
|
eb99c10ad0 | ||
|
|
175b7b89e4 | ||
|
|
5374afb226 | ||
|
|
1a44f48fad | ||
|
|
50dbe7cfc0 | ||
|
|
c7e576c879 | ||
|
|
a3e4847744 | ||
|
|
903f8ed5a7 | ||
|
|
b091c7f364 | ||
|
|
e069db3c45 | ||
|
|
047264dbbc | ||
|
|
0c216ba87a | ||
|
|
31cdc28143 | ||
|
|
e03b728240 | ||
|
|
4c275ba52f | ||
|
|
2ac9a888a8 | ||
|
|
f9bdcf8938 | ||
|
|
c3bef26ae6 | ||
|
|
634849c347 | ||
|
|
c557b737f6 | ||
|
|
1d326afa93 | ||
|
|
cb6c58cb5d | ||
|
|
ec4d708569 | ||
|
|
05b19cefa5 | ||
|
|
fdd57d0801 | ||
|
|
c16d6d1644 | ||
|
|
656b39c880 | ||
|
|
753c996291 | ||
|
|
dcdd0cc2bb | ||
|
|
2f32df16d9 | ||
|
|
9caa9c47b4 | ||
|
|
55bec8a911 | ||
|
|
43f95fd40e | ||
|
|
641812e7c1 | ||
|
|
95d3e75425 | ||
|
|
7f06c7e92e | ||
|
|
0e6fdffeec | ||
|
|
f77681b9c9 | ||
|
|
535d4bbe1b | ||
|
|
1dfbca3d5b | ||
|
|
d2ca265cc2 | ||
|
|
fc70345fcd | ||
|
|
6ae9b982a9 | ||
|
|
0122b4c6ce | ||
|
|
08c0faa20e | ||
|
|
ab7efea8c5 | ||
|
|
f4623664d5 | ||
|
|
df147435c5 | ||
|
|
71c1c5ae83 | ||
|
|
0ea142d6db | ||
|
|
f88a3059be | ||
|
|
48281ddf86 | ||
|
|
7cdcf9b757 | ||
|
|
ef0bb12fbd | ||
|
|
a0857f86b2 | ||
|
|
2219b3f47b | ||
|
|
b6c873f22d | ||
|
|
64bc92a7fd | ||
|
|
6c4c0f7595 | ||
|
|
2d9c977805 | ||
|
|
dff0375848 | ||
|
|
ab825a1a70 | ||
|
|
466617847f | ||
|
|
a53fff2416 | ||
|
|
dd1430dbbf | ||
|
|
5aad16968b | ||
|
|
f2d3acb650 | ||
|
|
666f8c813d | ||
|
|
e87fb7b50e | ||
|
|
75612879c7 | ||
|
|
94e0c80d47 | ||
|
|
feb6f4cbe0 | ||
|
|
1173bbf628 | ||
|
|
1cdc2e93ad | ||
|
|
3356bd8825 | ||
|
|
decc7a4a1e | ||
|
|
a397cab61c | ||
|
|
228e3d9ae3 | ||
|
|
051f670453 | ||
|
|
cf8aa86a67 | ||
|
|
5b00286e65 | ||
|
|
6597caaf05 | ||
|
|
5851124dee | ||
|
|
b18689a0d6 | ||
|
|
a5e7f78a1f | ||
|
|
a1d394fbc2 | ||
|
|
5e82bda666 | ||
|
|
3d5580ad9d | ||
|
|
c83cfbe8b0 | ||
|
|
00cc1b62ef | ||
|
|
e782f75863 | ||
|
|
f5f379465f | ||
|
|
70a8fda449 | ||
|
|
ca14302191 | ||
|
|
7297c2626f | ||
|
|
92a3982f21 | ||
|
|
626f5efdcd | ||
|
|
24e780b984 | ||
|
|
596d4aceb6 | ||
|
|
e770254b65 | ||
|
|
7901c26d32 | ||
|
|
fc65f8f689 | ||
|
|
e0a5e14978 | ||
|
|
07562c203a | ||
|
|
8187a19e6e | ||
|
|
32cd684307 | ||
|
|
3a72fc95d9 | ||
|
|
64405fba3d | ||
|
|
cc7981229c | ||
|
|
3ec208dc85 | ||
|
|
1b92b6cbfa | ||
|
|
779addfcb4 | ||
|
|
7da5f7a884 | ||
|
|
34e14636d4 | ||
|
|
aa222aac31 | ||
|
|
5134caa103 | ||
|
|
dca3c92d72 | ||
|
|
a85d5bad46 | ||
|
|
716613a4db | ||
|
|
12eaa66bc5 | ||
|
|
a6af97e3c1 | ||
|
|
d561c86c68 | ||
|
|
f243d1c9b4 | ||
|
|
1cc2cc6400 | ||
|
|
15f4c05772 | ||
|
|
c9a204b7a7 | ||
|
|
3d0018c0bd | ||
|
|
d639e46bc7 | ||
|
|
fa633bf419 | ||
|
|
40f7ef90b3 | ||
|
|
50efe607d4 | ||
|
|
3b057f2c27 | ||
|
|
d3d018bd44 | ||
|
|
1378609aa2 | ||
|
|
001c896eed | ||
|
|
1cf3a0143c | ||
|
|
f04be521e5 | ||
|
|
2873632a40 | ||
|
|
075879b5b5 | ||
|
|
9b12930376 | ||
|
|
3339ba9bad | ||
|
|
68922676fc | ||
|
|
dcf2afb4a6 | ||
|
|
16a35141dd | ||
|
|
f6c334bdad | ||
|
|
cbb119117b | ||
|
|
cae0a6118f |
@@ -47,4 +47,4 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: "Additional Information"
|
label: "Additional Information"
|
||||||
description: "If you have any additional information to provide, you can include it here (screenshots, videos, etc., are welcome)."
|
description: "If you have any additional information to provide, you can include it here (screenshots, videos, etc., are welcome)."
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ blank_issues_enabled: false
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: Questions & Discussions
|
- name: Questions & Discussions
|
||||||
url: https://github.com/1Panel-dev/1Panel/discussions
|
url: https://github.com/1Panel-dev/1Panel/discussions
|
||||||
about: Raise questions about the installation, deployment, use and other aspects of the project.
|
about: Raise questions about the installation, deployment, use and other aspects of the project.
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
version: 2
|
|
||||||
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "gomod"
|
|
||||||
directories:
|
|
||||||
- "/agent"
|
|
||||||
- "/core"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/frontend"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
name: General PR Handling for 1Panel
|
name: General PR Handling for 1Panel
|
||||||
on: pull_request
|
on: pull_request
|
||||||
permissions:
|
permissions:
|
||||||
@@ -6,7 +5,6 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
generic_handler:
|
generic_handler:
|
||||||
name: Add Labels to PR
|
name: Add Labels to PR
|
||||||
if: github.repository == '1Panel-dev/1Panel' && github.event.pull_request.user.login != 'dependabot[bot]'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --only-current-dir --force
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
name: Create Release And Upload Cloudflare R2
|
||||||
|
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 Rclone
|
||||||
|
uses: AnimMouse/setup-rclone@v1
|
||||||
|
with:
|
||||||
|
rclone_config: ${{ secrets.RCLONE_CONFIG }}
|
||||||
|
- name: Upload to Cloudflare R2
|
||||||
|
run: |
|
||||||
|
rclone copy dist/ cloudflare_r2:package/stable/${{ github.ref_name }}/release/ --include "*.tar.gz" --include "checksums.txt" --progress
|
||||||
@@ -11,4 +11,4 @@ jobs:
|
|||||||
- uses: usthe/issues-translate-action@v2.7
|
- uses: usthe/issues-translate-action@v2.7
|
||||||
with:
|
with:
|
||||||
IS_MODIFY_TITLE: true
|
IS_MODIFY_TITLE: true
|
||||||
BOT_GITHUB_TOKEN: ${{ secrets.ISSUE_TRANSLATOR_TOKEN }}
|
BOT_GITHUB_TOKEN: ${{ secrets.ISSUE_TRANSLATOR_TOKEN }}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: LLM Code Review
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
jobs:
|
||||||
|
llm-code-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: fit2cloud/LLM-CodeReview-Action@main
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.FIT2CLOUDRD_LLM_CODE_REVIEW_TOKEN }}
|
||||||
|
OPENAI_API_KEY: ${{ secrets.ALIYUN_LLM_API_KEY }}
|
||||||
|
LANGUAGE: English
|
||||||
|
OPENAI_API_ENDPOINT: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||||
|
MODEL: qwen2.5-coder-3b-instruct
|
||||||
|
PROMPT: "Please check the following code differences for any irregularities, potential issues, or optimization suggestions, and provide your answers in English."
|
||||||
|
top_p: 1
|
||||||
|
temperature: 1
|
||||||
|
# max_tokens: 10000
|
||||||
|
MAX_PATCH_LENGTH: 10000
|
||||||
|
IGNORE_PATTERNS: "/node_modules,*.md,/dist,/.github"
|
||||||
|
FILE_PATTERNS: "*.java,*.go,*.py,*.vue,*.ts,*.js,*.css,*.scss,*.html"
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
name: SonarCloud Scan
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
jobs:
|
||||||
|
sonarcloud:
|
||||||
|
name: SonarCloud
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: SonarCloud Scan
|
||||||
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
@@ -2,15 +2,14 @@ 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.
|
||||||
uses: Yikun/hub-mirror-action@ba51c01b28a6c9f95a25d4f1bcf6af2a147c0e18 # master
|
uses: Yikun/hub-mirror-action@master
|
||||||
with:
|
with:
|
||||||
src: 'github/1Panel-dev'
|
src: 'github/1Panel-dev'
|
||||||
dst: 'gitee/fit2cloud-feizhiyun'
|
dst: 'gitee/fit2cloud-feizhiyun'
|
||||||
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
|
||||||
dst_token: ${{ secrets.GITEE_TOKEN }}
|
dst_token: ${{ secrets.GITEE_TOKEN }}
|
||||||
static_list: "1Panel"
|
static_list: "1Panel"
|
||||||
force_update: true
|
force_update: true
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
name: Typos Check
|
||||||
|
on: pull_request
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
name: Spell Check with Typos
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Actions Repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Check spelling
|
||||||
|
uses: crate-ci/typos@master
|
||||||
+8
-38
@@ -4,17 +4,16 @@
|
|||||||
*.dll
|
*.dll
|
||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
build/1panel-agent
|
build/1panel
|
||||||
build/1panel-core
|
|
||||||
|
|
||||||
# Mac
|
# Mac
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
*/.DS_Store
|
||||||
|
|
||||||
# VS Code
|
# VS Code
|
||||||
.vscode
|
.vscode
|
||||||
*.project
|
*.project
|
||||||
*.factorypath
|
*.factorypath
|
||||||
__debug*
|
|
||||||
|
|
||||||
# IntelliJ IDEA
|
# IntelliJ IDEA
|
||||||
.idea/*
|
.idea/*
|
||||||
@@ -23,7 +22,6 @@ __debug*
|
|||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
*.test
|
*.test
|
||||||
|
|
||||||
@@ -33,31 +31,15 @@ __debug*
|
|||||||
# Dependency directories
|
# Dependency directories
|
||||||
/pkg/
|
/pkg/
|
||||||
backend/__debug_bin
|
backend/__debug_bin
|
||||||
core/cmd/server/__debug_bin
|
cmd/server/__debug_bin
|
||||||
core/cmd/server/web/assets
|
cmd/server/web/assets
|
||||||
core/cmd/server/web/monacoeditorwork
|
cmd/server/web/monacoeditorwork
|
||||||
core/cmd/server/web/index.html
|
cmd/server/web/index.html
|
||||||
frontend/auto-imports.d.ts
|
frontend/auto-imports.d.ts
|
||||||
frontend/components.d.ts
|
frontend/components.d.ts
|
||||||
frontend/src/xpack
|
frontend/src/xpack
|
||||||
frontend/src/enterprise
|
backend/xpack
|
||||||
agent/xpack
|
*_xpack.go
|
||||||
agent/enterprise
|
|
||||||
agent/router/entry_xpack.go
|
|
||||||
agent/router/entry_enterprise.go
|
|
||||||
agent/server/init_xpack.go
|
|
||||||
agent/server/init_enterprise.go
|
|
||||||
agent/utils/xpack/xpack.go
|
|
||||||
agent/utils/xpack/enterprise.go
|
|
||||||
core/xpack
|
|
||||||
core/enterprise
|
|
||||||
core/router/entry_xpack.go
|
|
||||||
core/router/entry_enterprise.go
|
|
||||||
core/server/init_xpack.go
|
|
||||||
core/server/init_enterprise.go
|
|
||||||
core/utils/xpack/xpack.go
|
|
||||||
core/utils/xpack/enterprise.go
|
|
||||||
|
|
||||||
.history/
|
.history/
|
||||||
dist/
|
dist/
|
||||||
1pctl
|
1pctl
|
||||||
@@ -67,15 +49,3 @@ quick_start.sh
|
|||||||
cmd/server/fileList.txt
|
cmd/server/fileList.txt
|
||||||
.fileList.txt
|
.fileList.txt
|
||||||
1Panel.code-workspace
|
1Panel.code-workspace
|
||||||
|
|
||||||
core/.golangci.yml
|
|
||||||
agent/.golangci.yml
|
|
||||||
|
|
||||||
.opencode
|
|
||||||
openspec
|
|
||||||
CLAUDE.md
|
|
||||||
AGENTS.md
|
|
||||||
opencode.json
|
|
||||||
superpowers
|
|
||||||
.worktrees/
|
|
||||||
.codex/
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||||
|
# vim: set ts=2 sw=2 tw=0 fo=jcroql
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
# - export NODE_OPTIONS="--max-old-space-size=8192"
|
||||||
|
# - make build_web
|
||||||
|
- chmod +x ./ci/script.sh
|
||||||
|
- ./ci/script.sh
|
||||||
|
- sed -i 's@ORIGINAL_VERSION=.*@ORIGINAL_VERSION=v{{ .Version }}@g' 1pctl
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- main: ./cmd/server/main.go
|
||||||
|
binary: 1panel
|
||||||
|
flags:
|
||||||
|
- -tags=xpack
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -w -s
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
goarm:
|
||||||
|
- 7
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm64
|
||||||
|
- arm
|
||||||
|
- ppc64le
|
||||||
|
- s390x
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- formats: [ 'tar.gz' ]
|
||||||
|
name_template: "1panel-v{{ .Version }}-{{ .Os }}-{{ .Arch }}{{- if .Arm }}v{{ .Arm }}{{ end }}"
|
||||||
|
wrap_in_directory: true
|
||||||
|
files:
|
||||||
|
- 1pctl
|
||||||
|
- 1panel.service
|
||||||
|
- install.sh
|
||||||
|
- GeoIP.mmdb
|
||||||
|
- lang/*
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: 'checksums.txt'
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- "^docs:"
|
||||||
|
- "^test:"
|
||||||
Generated
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 3.3 KiB |
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"ansible.python.interpreterPath": "/opt/homebrew/bin/python3"
|
|
||||||
}
|
|
||||||
+2
-4
@@ -10,12 +10,10 @@ PR are always welcome, even if they only contain small fixes like typos or a few
|
|||||||
|
|
||||||
Please submit a PR broken down into small changes bit by bit. A PR consisting of a lot of features and code changes may be hard to review. It is recommended to submit PRs in an incremental fashion.
|
Please submit a PR broken down into small changes bit by bit. A PR consisting of a lot of features and code changes may be hard to review. It is recommended to submit PRs in an incremental fashion.
|
||||||
|
|
||||||
|
This [development guideline](https://docs.1panel.pro/dev_manual/dev_manual/) contains information about repository structure, how to set up development environment, how to run it, and more.
|
||||||
|
|
||||||
Note: If you split your pull request to small changes, please make sure any of the changes goes to master will not break anything. Otherwise, it can not be merged until this feature complete.
|
Note: If you split your pull request to small changes, please make sure any of the changes goes to master will not break anything. Otherwise, it can not be merged until this feature complete.
|
||||||
|
|
||||||
## Add a new translation
|
|
||||||
|
|
||||||
If you'd like to help translate 1Panel into a new language, please read the [Translation Contribution Guide](docs/TRANSLATION.md). It lists every file you need to create or modify, along with a reference PR you can use as a concrete example.
|
|
||||||
|
|
||||||
## Report issues
|
## Report issues
|
||||||
It is a great way to contribute by reporting an issue. Well-written and complete bug reports are always welcome! Please open an issue and follow the template to fill in required information.
|
It is a great way to contribute by reporting an issue. Well-written and complete bug reports are always welcome! Please open an issue and follow the template to fill in required information.
|
||||||
|
|
||||||
|
|||||||
@@ -2,48 +2,33 @@ GOCMD=go
|
|||||||
GOBUILD=$(GOCMD) build
|
GOBUILD=$(GOCMD) build
|
||||||
GOCLEAN=$(GOCMD) clean
|
GOCLEAN=$(GOCMD) clean
|
||||||
GOARCH=$(shell go env GOARCH)
|
GOARCH=$(shell go env GOARCH)
|
||||||
GOOS=$(shell go env GOOS )
|
GOOS=$(shell go env GOOS)
|
||||||
|
|
||||||
BASE_PATH := $(shell pwd)
|
BASE_PATH := $(shell pwd)
|
||||||
BUILD_PATH = $(BASE_PATH)/build
|
BUILD_PATH = $(BASE_PATH)/build
|
||||||
WEB_PATH=$(BASE_PATH)/frontend
|
WEB_PATH=$(BASE_PATH)/frontend
|
||||||
ASSERT_PATH= $(BASE_PATH)/core/cmd/server/web/assets
|
SERVER_PATH=$(BASE_PATH)/backend
|
||||||
|
MAIN= $(BASE_PATH)/cmd/server/main.go
|
||||||
CORE_PATH=$(BASE_PATH)/core
|
APP_NAME=1panel
|
||||||
CORE_MAIN=$(CORE_PATH)/cmd/server/main.go
|
ASSERT_PATH= $(BASE_PATH)/cmd/server/web/assets
|
||||||
CORE_NAME=1panel-core
|
|
||||||
|
|
||||||
AGENT_PATH=$(BASE_PATH)/agent
|
|
||||||
AGENT_MAIN=$(AGENT_PATH)/cmd/server/main.go
|
|
||||||
AGENT_NAME=1panel-agent
|
|
||||||
|
|
||||||
|
|
||||||
clean_assets:
|
clean_assets:
|
||||||
rm -rf $(ASSERT_PATH)
|
rm -rf $(ASSERT_PATH)
|
||||||
|
|
||||||
upx_bin:
|
upx_bin:
|
||||||
upx $(BUILD_PATH)/$(CORE_NAME)
|
upx $(BUILD_PATH)/$(APP_NAME)
|
||||||
upx $(BUILD_PATH)/$(AGENT_NAME)
|
|
||||||
|
|
||||||
build_frontend:
|
build_frontend:
|
||||||
cd $(WEB_PATH) && npm install && npm run build:pro
|
cd $(WEB_PATH) && npm install && npm run build:pro
|
||||||
|
|
||||||
build_core_on_linux:
|
build_backend_on_linux:
|
||||||
cd $(CORE_PATH) \
|
cd $(SERVER_PATH) \
|
||||||
&& CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
||||||
|
|
||||||
build_agent_on_linux:
|
build_backend_on_darwin:
|
||||||
cd $(AGENT_PATH) \
|
cd $(SERVER_PATH) \
|
||||||
&& CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
|
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
||||||
|
|
||||||
build_core_on_darwin:
|
build_all: build_frontend build_backend_on_linux
|
||||||
cd $(CORE_PATH) \
|
|
||||||
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
|
|
||||||
|
|
||||||
build_agent_on_darwin:
|
build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin
|
||||||
cd $(AGENT_PATH) \
|
|
||||||
&& 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_on_local: clean_assets build_frontend build_core_on_darwin build_agent_on_darwin
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ reviewers:
|
|||||||
- wanghe-fit2cloud
|
- wanghe-fit2cloud
|
||||||
- zhengkunwang223
|
- zhengkunwang223
|
||||||
- ssongliu
|
- ssongliu
|
||||||
- lan-yonghui
|
|
||||||
|
|
||||||
approvers:
|
approvers:
|
||||||
- wanghe-fit2cloud
|
- wanghe-fit2cloud
|
||||||
- zhengkunwang223
|
- zhengkunwang223
|
||||||
- ssongliu
|
- ssongliu
|
||||||
- lan-yonghui
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
<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">
|
<p align="center"><b>Top-Rated Web-based Linux Server Management Tool</b><br>Best VPS control panel<br>新一代的 Linux 服务器运维管理面板</p>
|
||||||
Loved by a global community of <strong>2.5M+</strong> self-hosters.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://shields.io/github/license/1Panel-dev/1Panel?color=%231890FF" alt="License: GPL v3"></a>
|
<a href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://shields.io/github/license/1Panel-dev/1Panel?color=%231890FF" alt="License: GPL v3"></a>
|
||||||
<a href="https://discord.gg/bUpUqWqdRr"><img src="https://img.shields.io/discord/1318846410149335080?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb" alt="Discord"></a>
|
<a href="https://app.codacy.com/gh/1Panel-dev/1Panel?utm_source=github.com&utm_medium=referral&utm_content=1Panel-dev/1Panel&utm_campaign=Badge_Grade_Dashboard"><img src="https://app.codacy.com/project/badge/Grade/da67574fd82b473992781d1386b937ef" alt="Codacy"></a>
|
||||||
|
<a href="https://discord.gg/bUpUqWqdRr" target="_blank">
|
||||||
|
<img src="https://img.shields.io/discord/1318846410149335080?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb"
|
||||||
|
alt="chat on Discord"></a>
|
||||||
<a href="https://github.com/1Panel-dev/1Panel/releases"><img src="https://img.shields.io/github/v/release/1Panel-dev/1Panel" alt="GitHub release"></a>
|
<a href="https://github.com/1Panel-dev/1Panel/releases"><img src="https://img.shields.io/github/v/release/1Panel-dev/1Panel" alt="GitHub release"></a>
|
||||||
<a href="https://github.com/1Panel-dev/1Panel"><img src="https://img.shields.io/github/stars/1Panel-dev/1Panel?color=%231890FF&style=flat-square" alt="Stars"></a>
|
<a href="https://github.com/1Panel-dev/1Panel"><img src="https://img.shields.io/github/stars/1Panel-dev/1Panel?color=%231890FF&style=flat-square" alt="Stars"></a><br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="/README.md"><img alt="English" src="https://img.shields.io/badge/English-d9d9d9"></a>
|
<a href="/README.md"><img alt="English" src="https://img.shields.io/badge/English-d9d9d9"></a>
|
||||||
<a href="/docs/README.zh-Hans.md"><img alt="中文(简体)" src="https://img.shields.io/badge/中文(简体)-d9d9d9"></a>
|
<a href="/docs/README.zh-Hans.md"><img alt="中文(简体)" src="https://img.shields.io/badge/中文(简体)-d9d9d9"></a>
|
||||||
@@ -21,83 +19,60 @@
|
|||||||
<a href="/docs/README.pt-br.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-d9d9d9"></a>
|
<a href="/docs/README.pt-br.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-d9d9d9"></a>
|
||||||
<a href="/docs/README.ar.md"><img alt="العربية" src="https://img.shields.io/badge/العربية-d9d9d9"></a>
|
<a href="/docs/README.ar.md"><img alt="العربية" src="https://img.shields.io/badge/العربية-d9d9d9"></a>
|
||||||
<a href="/docs/README.de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-d9d9d9"></a>
|
<a href="/docs/README.de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-d9d9d9"></a>
|
||||||
<a href="/docs/README.es-es.md"><img alt="Español" src="https://img.shields.io/badge/Español-d9d9d9"></a>
|
<a href="/docs/README.es.md"><img alt="Español" src="https://img.shields.io/badge/Español-d9d9d9"></a><br>
|
||||||
<a href="/docs/README.fr.md"><img alt="français" src="https://img.shields.io/badge/français-d9d9d9"></a>
|
<a href="/docs/README.fr.md"><img alt="français" src="https://img.shields.io/badge/français-d9d9d9"></a>
|
||||||
<a href="/docs/README.ko.md"><img alt="한국어" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
|
<a href="/docs/README.ko.md"><img alt="한국어" src="https://img.shields.io/badge/한국어-d9d9d9"></a>
|
||||||
<a href="/docs/README.id.md"><img alt="Bahasa Indonesia" src="https://img.shields.io/badge/Bahasa Indonesia-d9d9d9"></a>
|
<a href="/docs/README.id.md"><img alt="Bahasa Indonesia" src="https://img.shields.io/badge/Bahasa Indonesia-d9d9d9"></a>
|
||||||
<a href="/docs/README.zh-Hant.md"><img alt="中文(繁體)" src="https://img.shields.io/badge/中文(繁體)-d9d9d9"></a>
|
<a href="/docs/README.zh-Hant.md"><img alt="中文(繁體)" src="https://img.shields.io/badge/中文(繁體)-d9d9d9"></a>
|
||||||
<a href="/docs/README.tr.md"><img alt="Türkçe" src="https://img.shields.io/badge/Türkçe-d9d9d9"></a>
|
<a href="/docs/README.tr.md"><img alt="Türkçe" src="https://img.shields.io/badge/Türkçe-d9d9d9"></a>
|
||||||
<a href="/docs/README.ru.md"><img alt="Русский" src="https://img.shields.io/badge/Русский-d9d9d9"></a>
|
<a href="/docs/README.ru.md"><img alt="Русский" src="https://img.shields.io/badge/%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9-d9d9d9"></a>
|
||||||
<a href="/docs/README.ms.md"><img alt="Bahasa Melayu" src="https://img.shields.io/badge/Bahasa Melayu-d9d9d9"></a>
|
<a href="/docs/README.ms.md"><img alt="Bahasa Melayu" src="https://img.shields.io/badge/Bahasa Melayu-d9d9d9"></a>
|
||||||
<a href="/docs/README.fa.md"><img alt="Persian" src="https://img.shields.io/badge/%D9%81%D8%A7%D8%B1%D8%B3%DB%8C-d9d9d9"></a>
|
|
||||||
<a href="/docs/README.lo.md"><img alt="ພາສາລາວ" src="https://img.shields.io/badge/%E0%BA%9E%E0%BA%B2%E0%BA%AA%E0%BA%B2%E0%BA%A5%E0%BA%B2%E0%BA%A7-d9d9d9"></a>
|
|
||||||
</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 Linux server management panel and a lightweight AI management platform. Through an intuitive web interface, it provides users with comprehensive, one-stop server management capabilities:
|
- **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.
|
||||||
- **AI Management**: Offers a unified management platform from bare metal to agents (Metal-to-Agent). It integrates an AI gateway, and Skills Hub, while supporting centralized management of agents and models.
|
- **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.
|
||||||
- **Efficient Visual Operations**: Easily manage Linux servers through a web-based GUI, streamlining tasks such as host monitoring, file management, database management, and container management.
|
- **Application Store**: 1Panel curates a wide range of high-quality open-source tools and applications, facilitating easy installation and updates for its users.
|
||||||
- **Rapid Website Deployment**: Deeply integrates with popular website builders like WordPress and Halo. It enables one-click domain binding and SSL certificate configuration, significantly lowering the barrier to website creation.
|
- **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.
|
||||||
- **Curated App Store**: Features a built-in store of high-quality open-source applications, providing one-click installation and upgrade services to effortlessly extend server capabilities.
|
- **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.
|
||||||
- **Enterprise-Grade Security**: Deploys applications based on container technology to effectively minimize vulnerability exposure. It also provides security features such as WAF and log auditing to ensure comprehensive server protection.
|
|
||||||
- **One-Click Data Backup**: Supports one-click backup and restoration, and integrates with various cloud storage solutions to ensure data security and prevent loss.
|
|
||||||
|
|
||||||
## Why 1Panel?
|
|
||||||
|
|
||||||
| | 1Panel | cPanel / Plesk | aaPanel | Webmin |
|
|
||||||
|--|--------|----------------|---------|--------|
|
|
||||||
| Free & open source | ✅ | ❌ | Partial | ✅ |
|
|
||||||
| AI management | ✅ | ❌ | ❌ | ❌ |
|
|
||||||
| One-click app marketplace | ✅ 165+ apps | ❌ | ✅ | ❌ |
|
|
||||||
| Modern UI (post-2020) | ✅ | ❌ | Partial | ❌ |
|
|
||||||
| Docker / container management | ✅ | ❌ | ❌ | ❌ |
|
|
||||||
| Active development | ✅ | ✅ | ✅ | Slow |
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Prepare your Linux server and run the following script:
|
Execute the script below and follow the prompts to install 1Panel:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash -c "$(curl -sSL https://resource.1panel.pro/v2/quick_start.sh)"
|
curl -sSL https://resource.1panel.pro/quick_start.sh -o quick_start.sh && bash quick_start.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
After installation, open `http://<your-server-ip>:<port>/<security-path>` in your browser.
|
Please refer to our [documentation](https://docs.1panel.pro/quick_start/) for more details.
|
||||||
Run `1pctl user-info` via SSH if you need to retrieve your access credentials.
|
|
||||||
|
中国用户请使用这个 [安装脚本](https://1panel.cn/docs/installation/online_installation/),其应用数量比国际版本更丰富。
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Star History
|
||||||
|
|
||||||
|
[](https://star-history.com/#1Panel-dev/1Panel&Date)
|
||||||
|
|
||||||
## Pro Edition
|
## Pro Edition
|
||||||
|
|
||||||
1Panel OSS is free forever. 1Panel Pro and Ent adds features built for teams and production workloads:
|
Compared to the OSS Edition, 1Panel Pro Edition provides users with a wealth of enhanced features and technical support services. Enhanced features include WAF enhancement, Website monitoring, Mobile APP, custom logo and theme, etc.
|
||||||
|
|
||||||
| Feature | OSS | Pro | Ent |
|
[Click to see Pro Edition details](https://1panel.pro/pricing).
|
||||||
|---------|:---:|:---:|:---:|
|
|
||||||
| One-click app installs | ✅ | ✅ | ✅ |
|
|
||||||
| AI agents (OpenClaw) | 5 agent | Unlimited | ✅ |
|
|
||||||
| WAF & advanced security | Basic | ✅ | ✅ |
|
|
||||||
| Website tamper protection | ❌ | ✅ | ✅ |
|
|
||||||
| Website uptime monitoring | ❌ | ✅ | ✅ |
|
|
||||||
| Multi-node management | ❌ | ✅ | ✅ |
|
|
||||||
| Custom logo & theme | ❌ | ✅ | ✅ |
|
|
||||||
| KVM Web UI | ❌ | ❌ | ✅ |
|
|
||||||
| AI Gateway | ❌ | ❌ | ✅ |
|
|
||||||
| Priority support | ❌ | ❌ | ✅ |
|
|
||||||
|
|
||||||
## Community & Support
|
## Security Information
|
||||||
|
|
||||||
- **Discord** — [Join the community](https://discord.gg/bUpUqWqdRr) for help, feature requests, and show-and-tell
|
If you discover any security issues, please refer to [SECURITY.md](/SECURITY.md).
|
||||||
- **Docs** — [1panel.pro/docs](https://1panel.pro/docs)
|
|
||||||
- **Issues** — [GitHub Issues](https://github.com/1Panel-dev/1Panel/issues) for bug reports
|
|
||||||
|
|
||||||
## Security
|
|
||||||
|
|
||||||
Found a vulnerability? Please read [SECURITY.md](/SECURITY.md) before disclosing.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html).
|
Licensed under The GNU General Public License version 3 (GPLv3) (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
<https://www.gnu.org/licenses/gpl-3.0.html>
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,395 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"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/repo"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/constant"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
const defaultAuditUser = "system"
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Page alert
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertSearch true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/search [post]
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Create alert
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["title"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建告警任务 [title]","formatEN":"create alert [title]"}
|
|
||||||
func (b *BaseApi) CreateAlert(c *gin.Context) {
|
|
||||||
var req dto.AlertCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := alertService.CreateAlert(req, loadAuditUser(c))
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Delete alert
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.DeleteRequest true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除告警任务 [id]","formatEN":"delete alert [id]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Update alert
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["title"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新告警任务 [title]","formatEN":"update alert [title]"}
|
|
||||||
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, loadAuditUser(c)); 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Update alert status
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertUpdateStatus true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/status [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","status"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新告警任务 [id] 状态 [status]","formatEN":"update alert [id] status [status]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Get disks
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/disks/list [get]
|
|
||||||
func (b *BaseApi) GetDisks(c *gin.Context) {
|
|
||||||
alerts, err := alertService.GetDisks()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, alerts)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Page alert logs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertLogSearch true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/logs/search [post]
|
|
||||||
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,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Clean alert logs
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/logs/clean [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清空告警日志","formatEN":"clean alert logs"}
|
|
||||||
func (b *BaseApi) CleanAlertLogs(c *gin.Context) {
|
|
||||||
if err := alertService.CleanAlertLogs(); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Get clams
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/clams/list [get]
|
|
||||||
func (b *BaseApi) GetClams(c *gin.Context) {
|
|
||||||
clams, err := alertService.GetClams()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, clams)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Get cron jobs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.CronJobReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/cronjob/list [post]
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Get alert config
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/info [post]
|
|
||||||
func (b *BaseApi) GetAlertConfig(c *gin.Context) {
|
|
||||||
var req dto.AlertConfigQuery
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
config, err := alertService.GetAlertConfig(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, config)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Page alert config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertConfigPageReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/search [post]
|
|
||||||
func (b *BaseApi) PageAlertConfig(c *gin.Context) {
|
|
||||||
var req dto.AlertConfigPageReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, configs, err := alertService.PageAlertConfig(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Total: total,
|
|
||||||
Items: configs,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Update alert config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertConfigUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","displayName"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新告警配置 [id][displayName]","formatEN":"update alert config [id][displayName]"}
|
|
||||||
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, loadAuditUser(c)); err != nil {
|
|
||||||
switch {
|
|
||||||
case errors.Is(err, repo.ErrAlertConfigRevisionConflict):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusConflict, "ALERT_CONFIG_REVISION_CONFLICT", "ErrInvalidParams", err)
|
|
||||||
case errors.Is(err, repo.ErrAlertConfigRevisionRequired):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusConflict, "ALERT_CONFIG_REVISION_REQUIRED", "ErrInvalidParams", err)
|
|
||||||
default:
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Update alert config status
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertConfigStatusUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/status [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","status"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新告警配置状态 [id][status]","formatEN":"update alert config status [id][status]"}
|
|
||||||
func (b *BaseApi) UpdateAlertConfigStatus(c *gin.Context) {
|
|
||||||
var req dto.AlertConfigStatusUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := alertService.UpdateAlertConfigStatus(req, loadAuditUser(c)); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadAuditUser(c *gin.Context) string {
|
|
||||||
userName := strings.TrimSpace(c.GetHeader("X-Panel-User"))
|
|
||||||
if userName == "" {
|
|
||||||
return defaultAuditUser
|
|
||||||
}
|
|
||||||
if decoded, err := url.QueryUnescape(userName); err == nil {
|
|
||||||
return decoded
|
|
||||||
}
|
|
||||||
return userName
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Delete alert config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.DeleteRequest true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除告警配置 [id]","formatEN":"delete alert config [id]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Alert
|
|
||||||
// @Summary Test alert config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AlertConfigTest true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /alert/config/test [post]
|
|
||||||
func (b *BaseApi) TestAlertConfig(c *gin.Context) {
|
|
||||||
var req dto.AlertConfigTest
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if req.Type == constant.Custom {
|
|
||||||
result, err := alertService.TestCustomAlertConfig(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
flag, err := alertService.TestAlertConfig(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, flag)
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
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 App
|
|
||||||
// @Summary List Upgrade Ignored App
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200 {array} model.AppIgnoreUpgrade
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /apps/ignored/detail [get]
|
|
||||||
func (b *BaseApi) ListAppIgnored(c *gin.Context) {
|
|
||||||
res, err := appIgnoreUpgradeService.List()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags App
|
|
||||||
// @Summary Ignore Upgrade App
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.AppIgnoreUpgradeReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /apps/installed/ignore [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"忽略应用升级","formatEN":"Ignore application upgrade"}
|
|
||||||
func (b *BaseApi) IgnoreAppUpgrade(c *gin.Context) {
|
|
||||||
var req request.AppIgnoreUpgradeReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := appIgnoreUpgradeService.CreateAppIgnore(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 写一个去掉忽略的接口
|
|
||||||
// @Tags App
|
|
||||||
// @Summary Cancel Ignore Upgrade App
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.ReqWithID true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /apps/ignored/cancel [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"取消忽略应用升级","formatEN":"Cancel ignore application upgrade"}
|
|
||||||
func (b *BaseApi) CancelIgnoreAppUpgrade(c *gin.Context) {
|
|
||||||
var req request.ReqWithID
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := appIgnoreUpgradeService.Delete(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Load os info
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200 {object} dto.OsInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/base/os [get]
|
|
||||||
func (b *BaseApi) LoadDashboardOsInfo(c *gin.Context) {
|
|
||||||
data, err := dashboardService.LoadOsInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Load app launcher
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200 {array} dto.AppLauncher
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/app/launcher [get]
|
|
||||||
func (b *BaseApi) LoadAppLauncher(c *gin.Context) {
|
|
||||||
data, err := dashboardService.LoadAppLauncher(c)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithDataGzipped(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Load app launcher options
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SearchByFilter true "request"
|
|
||||||
// @Success 200 {array} dto.LauncherOption
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/app/launcher/option [post]
|
|
||||||
func (b *BaseApi) LoadAppLauncherOption(c *gin.Context) {
|
|
||||||
var req dto.SearchByFilter
|
|
||||||
if err := helper.CheckBind(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := dashboardService.ListLauncherOption(req.Filter)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Update app Launcher
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SettingUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/app/launcher/show [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["key", "value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"首页应用 [key] => 显示:[value]","formatEN":"app launcher [key] => show: [value]"}
|
|
||||||
func (b *BaseApi) UpdateAppLauncher(c *gin.Context) {
|
|
||||||
var req dto.SettingUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := dashboardService.ChangeShow(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
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
|
|
||||||
// @Summary Load dashboard base info
|
|
||||||
// @Accept json
|
|
||||||
// @Param ioOption path string true "request"
|
|
||||||
// @Param netOption path string true "request"
|
|
||||||
// @Success 200 {object} dto.DashboardBase
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/base/:ioOption/:netOption [get]
|
|
||||||
func (b *BaseApi) LoadDashboardBaseInfo(c *gin.Context) {
|
|
||||||
ioOption, ok := c.Params.Get("ioOption")
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("error ioOption in path"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
netOption, ok := c.Params.Get("netOption")
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("error ioOption in path"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := dashboardService.LoadBaseInfo(ioOption, netOption)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Load dashboard current info for node
|
|
||||||
// @Success 200 {object} dto.NodeCurrent
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/current/node [get]
|
|
||||||
func (b *BaseApi) LoadCurrentInfoForNode(c *gin.Context) {
|
|
||||||
data := dashboardService.LoadCurrentInfoForNode()
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Dashboard
|
|
||||||
// @Summary Load dashboard current info
|
|
||||||
// @Accept json
|
|
||||||
// @Param ioOption path string true "request"
|
|
||||||
// @Param netOption path string true "request"
|
|
||||||
// @Success 200 {object} dto.DashboardCurrent
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/current/:ioOption/:netOption [get]
|
|
||||||
func (b *BaseApi) LoadDashboardCurrentInfo(c *gin.Context) {
|
|
||||||
ioOption, ok := c.Params.Get("ioOption")
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("error ioOption in path"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
netOption, ok := c.Params.Get("netOption")
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("error netOption in path"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data := dashboardService.LoadCurrentInfo(ioOption, netOption)
|
|
||||||
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
|
|
||||||
// @Summary System restart
|
|
||||||
// @Accept json
|
|
||||||
// @Param operation path string true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /dashboard/system/restart/:operation [post]
|
|
||||||
func (b *BaseApi) SystemRestart(c *gin.Context) {
|
|
||||||
operation, ok := c.Params.Get("operation")
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("error operation in path"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := dashboardService.Restart(operation); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
@@ -1,294 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/base64"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Create mongodb database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbDBCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 mongodb 数据库 [name]","formatEN":"create mongodb database [name]"}
|
|
||||||
func (b *BaseApi) CreateMongodb(c *gin.Context) {
|
|
||||||
var req dto.MongodbDBCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := mongodbService.Create(context.Background(), req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Page mongodb databases
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbDBSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/search [post]
|
|
||||||
func (b *BaseApi) SearchMongodb(c *gin.Context) {
|
|
||||||
var req dto.MongodbDBSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
total, list, err := mongodbService.SearchWithPage(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Items: list,
|
|
||||||
Total: total,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Update mongodb database description
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.UpdateDescription true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/description [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","description"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"database_mongodbs","output_column":"name","output_value":"name"}],"formatZH":"mongodb 数据库 [name] 描述信息修改 [description]","formatEN":"The description of the mongodb database [name] is modified => [description]"}
|
|
||||||
func (b *BaseApi) UpdateMongodbDescription(c *gin.Context) {
|
|
||||||
var req dto.UpdateDescription
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.UpdateDescription(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Load mongodb database from remote
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbLoadDB true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/load [post]
|
|
||||||
func (b *BaseApi) LoadMongodbFromRemote(c *gin.Context) {
|
|
||||||
var req dto.MongodbLoadDB
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.LoadFromRemote(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Bind mongodb database user info
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbBind true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/bind [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database", "name", "username"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"绑定 mongodb 数据库 [database] [name] 用户 [username]","formatEN":"bind mongodb database [database] [name] user [username]"}
|
|
||||||
func (b *BaseApi) BindMongodbUser(c *gin.Context) {
|
|
||||||
var req dto.MongodbBind
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.BindUser(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Change mongodb database password
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbPassword true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/password [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database", "name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 mongodb 数据库 [database] [name] 密码","formatEN":"update mongodb database [database] [name] password"}
|
|
||||||
func (b *BaseApi) ChangeMongodbPassword(c *gin.Context) {
|
|
||||||
var req dto.MongodbPassword
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.ChangePassword(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Change mongodb root password
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ChangeDBInfo true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/root/password [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 mongodb 数据库 [database] root 密码","formatEN":"update mongodb database [database] root password"}
|
|
||||||
func (b *BaseApi) ChangeMongodbRootPassword(c *gin.Context) {
|
|
||||||
var req dto.ChangeDBInfo
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Value) != 0 {
|
|
||||||
value, err := base64.StdEncoding.DecodeString(req.Value)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Value = string(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.ChangeRootPassword(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Load mongodb privileges
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbPrivilegesLoad true "request"
|
|
||||||
// @Success 200 {string} string
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/privileges [post]
|
|
||||||
func (b *BaseApi) LoadMongodbPrivileges(c *gin.Context) {
|
|
||||||
var req dto.MongodbPrivilegesLoad
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
permission, err := mongodbService.LoadPrivileges(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, permission)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Change mongodb privileges
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbPrivileges true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/privileges/change [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database", "username"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 mongodb 数据库 [database] 用户 [username] 权限","formatEN":"update mongodb database [database] user [username] privileges"}
|
|
||||||
func (b *BaseApi) ChangeMongodbPrivileges(c *gin.Context) {
|
|
||||||
var req dto.MongodbPrivileges
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mongodbService.ChangePrivileges(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Check before delete mongodb database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbDBDeleteCheck true "request"
|
|
||||||
// @Success 200 {array} string
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/del/check [post]
|
|
||||||
func (b *BaseApi) DeleteCheckMongodb(c *gin.Context) {
|
|
||||||
var req dto.MongodbDBDeleteCheck
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
apps, err := mongodbService.DeleteCheck(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, apps)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mongodb
|
|
||||||
// @Summary Delete mongodb database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MongodbDBDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/mongodb/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"database_mongodbs","output_column":"name","output_value":"name"}],"formatZH":"删除 mongodb 数据库 [name]","formatEN":"delete mongodb database [name]"}
|
|
||||||
func (b *BaseApi) DeleteMongodb(c *gin.Context) {
|
|
||||||
var req dto.MongodbDBDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tx, ctx := helper.GetTxAndContext()
|
|
||||||
if err := mongodbService.Delete(ctx, req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
tx.Rollback()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
tx.Commit()
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
@@ -1,551 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/base64"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Create mysql database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlDBCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 mysql 数据库 [name]","formatEN":"create mysql database [name]"}
|
|
||||||
func (b *BaseApi) CreateMysql(c *gin.Context) {
|
|
||||||
var req dto.MysqlDBCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := mysqlService.Create(context.Background(), req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary List mysql users
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserSearch true "request"
|
|
||||||
// @Success 200 {array} dto.MysqlUser
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users/search [post]
|
|
||||||
func (b *BaseApi) ListMysqlUsers(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := mysqlService.ListUsers(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Create mysql user
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 mysql 数据库 [database] 用户 [username]@[host]","formatEN":"create mysql database [database] user [username]@[host]"}
|
|
||||||
func (b *BaseApi) CreateMysqlUser(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
if err := mysqlService.CreateUser(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Delete mysql user
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除 mysql 数据库 [database] 用户 [username]@[host]","formatEN":"delete mysql database [database] user [username]@[host]"}
|
|
||||||
func (b *BaseApi) DeleteMysqlUser(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := mysqlService.DeleteUser(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Update mysql user
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","username","host","newHost","description"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 mysql 数据库 [database] 用户 [username] 访问权限 [host] => [newHost] 描述 [description]","formatEN":"update mysql database [database] user [username] access [host] => [newHost] description [description]"}
|
|
||||||
func (b *BaseApi) UpdateMysqlUser(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := mysqlService.UpdateUser(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Change mysql user password
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserPassword true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users/password [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 mysql 数据库 [database] 用户 [username]@[host] 密码","formatEN":"update mysql database [database] user [username]@[host] password"}
|
|
||||||
func (b *BaseApi) ChangeMysqlUserPassword(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserPassword
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
if err := mysqlService.ChangeUserPassword(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Save mysql user password locally
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserPassword true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/users/password/save [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"补充 mysql 数据库 [database] 用户 [username]@[host] 密码","formatEN":"save mysql database [database] user [username]@[host] password locally"}
|
|
||||||
func (b *BaseApi) SaveMysqlUserPassword(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserPassword
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(req.Password) != 0 {
|
|
||||||
password, err := base64.StdEncoding.DecodeString(req.Password)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Password = string(password)
|
|
||||||
}
|
|
||||||
if err := mysqlService.SaveUserPassword(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary List mysql grants
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlUserSearch true "request"
|
|
||||||
// @Success 200 {array} dto.MysqlGrant
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/grants/search [post]
|
|
||||||
func (b *BaseApi) ListMysqlGrants(c *gin.Context) {
|
|
||||||
var req dto.MysqlUserSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := mysqlService.ListGrants(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary List mysql grant summary
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlGrantSummarySearch true "request"
|
|
||||||
// @Success 200 {object} map[string][]dto.MysqlUser
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/grants/summary [post]
|
|
||||||
func (b *BaseApi) ListMysqlGrantSummary(c *gin.Context) {
|
|
||||||
var req dto.MysqlGrantSummarySearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := mysqlService.ListGrantSummary(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Grant mysql user
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlGrantCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/grants [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","db","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"授权 mysql 数据库 [database] 用户 [username]@[host] 访问 [db]","formatEN":"grant mysql database [database] user [username]@[host] access to [db]"}
|
|
||||||
func (b *BaseApi) GrantMysqlUser(c *gin.Context) {
|
|
||||||
var req dto.MysqlGrantCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := mysqlService.GrantUser(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Revoke mysql grant
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlGrantDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/grants/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database","db","username","host"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"取消 mysql 数据库 [database] 用户 [username]@[host] 对 [db] 的授权","formatEN":"revoke mysql database [database] user [username]@[host] access to [db]"}
|
|
||||||
func (b *BaseApi) RevokeMysqlGrant(c *gin.Context) {
|
|
||||||
var req dto.MysqlGrantDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := mysqlService.RevokeGrant(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Update mysql database description
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.UpdateDescription true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/description/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","description"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"database_mysqls","output_column":"name","output_value":"name"}],"formatZH":"mysql 数据库 [name] 描述信息修改 [description]","formatEN":"The description of the mysql database [name] is modified => [description]"}
|
|
||||||
func (b *BaseApi) UpdateMysqlDescription(c *gin.Context) {
|
|
||||||
var req dto.UpdateDescription
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mysqlService.UpdateDescription(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Change mysql root password
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ChangeDBInfo true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/change/password [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新数据库 [database] root 密码","formatEN":"Update database [database] root password"}
|
|
||||||
func (b *BaseApi) ChangeMysqlPassword(c *gin.Context) {
|
|
||||||
var req dto.ChangeDBInfo
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(req.Value) != 0 {
|
|
||||||
value, err := base64.StdEncoding.DecodeString(req.Value)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Value = string(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mysqlService.ChangePassword(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Change mysql root access
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ChangeDBInfo true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/change/access [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["database"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新数据库 [database] root 访问权限","formatEN":"Update database [database] root access"}
|
|
||||||
func (b *BaseApi) ChangeMysqlAccess(c *gin.Context) {
|
|
||||||
var req dto.ChangeDBInfo
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mysqlService.ChangeAccess(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Update mysql variables
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlVariablesUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/variables/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"调整 mysql 数据库性能参数","formatEN":"adjust mysql database performance parameters"}
|
|
||||||
func (b *BaseApi) UpdateMysqlVariables(c *gin.Context) {
|
|
||||||
var req dto.MysqlVariablesUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mysqlService.UpdateVariables(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Page mysql databases
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlDBSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/search [post]
|
|
||||||
func (b *BaseApi) SearchMysql(c *gin.Context) {
|
|
||||||
var req dto.MysqlDBSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
total, list, err := mysqlService.SearchWithPage(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Items: list,
|
|
||||||
Total: total,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary List mysql database format collation options
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperationWithName true "request"
|
|
||||||
// @Success 200 {array} dto.MysqlFormatCollationOption
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/format/options [post]
|
|
||||||
func (b *BaseApi) ListDBFormatCollationOptions(c *gin.Context) {
|
|
||||||
var req dto.OperationWithName
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, mysqlService.LoadFormatOption(req))
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Load mysql database from remote
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlLoadDB true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/load [post]
|
|
||||||
func (b *BaseApi) LoadDBFromRemote(c *gin.Context) {
|
|
||||||
var req dto.MysqlLoadDB
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := mysqlService.LoadFromRemote(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Check before delete mysql database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlDBDeleteCheck true "request"
|
|
||||||
// @Success 200 {array} string
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/del/check [post]
|
|
||||||
func (b *BaseApi) DeleteCheckMysql(c *gin.Context) {
|
|
||||||
var req dto.MysqlDBDeleteCheck
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
apps, err := mysqlService.DeleteCheck(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, apps)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Delete mysql database
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.MysqlDBDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"database_mysqls","output_column":"name","output_value":"name"}],"formatZH":"删除 mysql 数据库 [name]","formatEN":"delete mysql database [name]"}
|
|
||||||
func (b *BaseApi) DeleteMysql(c *gin.Context) {
|
|
||||||
var req dto.MysqlDBDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
tx, ctx := helper.GetTxAndContext()
|
|
||||||
if err := mysqlService.Delete(ctx, req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
tx.Rollback()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
tx.Commit()
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Load mysql remote access
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperationWithNameAndType true "request"
|
|
||||||
// @Success 200 {boolean} isRemote
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/remote [post]
|
|
||||||
func (b *BaseApi) LoadRemoteAccess(c *gin.Context) {
|
|
||||||
var req dto.OperationWithNameAndType
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
isRemote, err := mysqlService.LoadRemoteAccess(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, isRemote)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Load mysql status info
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperationWithNameAndType true "request"
|
|
||||||
// @Success 200 {object} dto.MysqlStatus
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/status [post]
|
|
||||||
func (b *BaseApi) LoadStatus(c *gin.Context) {
|
|
||||||
var req dto.OperationWithNameAndType
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := mysqlService.LoadStatus(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Database Mysql
|
|
||||||
// @Summary Load mysql variables info
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperationWithNameAndType true "request"
|
|
||||||
// @Success 200 {object} dto.MysqlVariables
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /databases/variables [post]
|
|
||||||
func (b *BaseApi) LoadVariables(c *gin.Context) {
|
|
||||||
var req dto.OperationWithNameAndType
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := mysqlService.LoadVariables(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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/request"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags File
|
|
||||||
// @Summary Load file history list
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FileHistorySearchReq true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /files/history/search [post]
|
|
||||||
func (b *BaseApi) SearchFileHistory(c *gin.Context) {
|
|
||||||
var req request.FileHistorySearchReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, items, err := fileHistoryService.Search(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{Items: items, Total: total})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags File
|
|
||||||
// @Summary Load file history content
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FileHistoryContentReq true "request"
|
|
||||||
// @Success 200 {object} response.FileHistoryInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /files/history/content [post]
|
|
||||||
func (b *BaseApi) GetFileHistoryContent(c *gin.Context) {
|
|
||||||
var req request.FileHistoryContentReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
item, err := fileHistoryService.GetContent(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, item)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags File
|
|
||||||
// @Summary Delete file history record
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FileHistoryDeleteReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /files/history/del [post]
|
|
||||||
func (b *BaseApi) DeleteFileHistory(c *gin.Context) {
|
|
||||||
var req request.FileHistoryDeleteReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := fileHistoryService.Delete(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags File
|
|
||||||
// @Summary Restore file history record
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FileHistoryRestoreReq true "request"
|
|
||||||
// @Success 200 {object} response.FileInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /files/history/restore [post]
|
|
||||||
func (b *BaseApi) RestoreFileHistory(c *gin.Context) {
|
|
||||||
var req request.FileHistoryRestoreReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
info, err := fileHistoryService.Restore(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, info)
|
|
||||||
}
|
|
||||||
@@ -1,680 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/buserr"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/docker"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/firewall/filter"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (b *BaseApi) UpdatePanelFirewallPort(c *gin.Context) {
|
|
||||||
if !global.IsMaster {
|
|
||||||
c.AbortWithStatus(http.StatusForbidden)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var request struct {
|
|
||||||
OldPort uint `json:"oldPort" validate:"required,min=1,max=65535"`
|
|
||||||
NewPort uint `json:"newPort" validate:"required,min=1,max=65535"`
|
|
||||||
}
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallService.UpdatePanelPort(c.Request.Context(), request.OldPort, request.NewPort); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Load firewall base info
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperationWithName true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallSubsystemStatus
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/base [post]
|
|
||||||
func (b *BaseApi) LoadFirewallBaseInfo(c *gin.Context) {
|
|
||||||
var request dto.OperationWithName
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := firewallService.LoadBaseInfo(request.Name)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Operate firewall
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallLifecycleOperation true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallLifecycleOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] 防火墙","formatEN":"[operation] firewall"}
|
|
||||||
func (b *BaseApi) OperateFirewall(c *gin.Context) {
|
|
||||||
var request dto.FirewallLifecycleOperation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := firewallService.QueueFirewallOperation(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Load forwarding base info
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200 {object} dto.FirewallSubsystemStatus
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/forward/base [post]
|
|
||||||
func (b *BaseApi) LoadForwardingBaseInfo(c *gin.Context) {
|
|
||||||
data, err := forwardingService.LoadBaseInfo(c.Request.Context())
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Page forwarding rules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ForwardRuleSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/forward/search [post]
|
|
||||||
func (b *BaseApi) SearchForwardingRules(c *gin.Context) {
|
|
||||||
var request dto.ForwardRuleSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, items, err := forwardingService.SearchRules(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{Items: items, Total: total})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Operate forwarding rules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.ForwardRuleOperate true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/forward/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新端口转发规则","formatEN":"update port forward rules"}
|
|
||||||
func (b *BaseApi) OperateForwardingRules(c *gin.Context) {
|
|
||||||
var request dto.ForwardRuleOperate
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
result, err := forwardingService.OperateRules(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Enable forwarding
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallInitializationTask true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/forward/enable [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"初始化并启用端口转发","formatEN":"initialize and enable port forwarding"}
|
|
||||||
func (b *BaseApi) EnableForwarding(c *gin.Context) {
|
|
||||||
var request dto.FirewallInitializationTask
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := forwardingService.QueueInitialization(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Apply/Unload/Init firewall filter chain
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FilterChainOperation true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/filter/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["operate"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operate] 防火墙过滤链","formatEN":"[operate] firewall filter chain"}
|
|
||||||
func (b *BaseApi) OperateFilterChain(c *gin.Context) {
|
|
||||||
var request dto.FilterChainOperation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if request.Operate == "init-base" {
|
|
||||||
result, err := firewallService.QueueFilterChainInitialization(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallService.OperateFilterChain(request); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.FilterChainOperationResponse{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary List unified firewall v2 rules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleInventory true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallRuleInventoryResponse
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/search [post]
|
|
||||||
func (b *BaseApi) SearchFirewallRules(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleInventory
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
inventory, err := firewallService.Inventory(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, inventory)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Reset firewall rules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleReset true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallRuleResetResponse
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/reset [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"重置防火墙规则","formatEN":"reset firewall rules"}
|
|
||||||
func (b *BaseApi) ResetFirewallRules(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleReset
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := firewallService.Reset(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Load one provider-native firewall object definition
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallNativeDetail true "request"
|
|
||||||
// @Success 200 {string} string
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/native/detail [post]
|
|
||||||
func (b *BaseApi) LoadFirewallNativeDetail(c *gin.Context) {
|
|
||||||
var request dto.FirewallNativeDetail
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
info, err := firewallService.LoadFirewallNativeDetail(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, info)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Queue firewall rule creation
|
|
||||||
// @Description Creation and import return a taskID immediately; validation and execution results are written to the task log.
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleCreate true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallRuleCreateResponse
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Failure 409 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"添加防火墙规则","formatEN":"create firewall rules"}
|
|
||||||
func (b *BaseApi) CreateFirewallRules(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := firewallService.Create(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Queue firewall rule deletion
|
|
||||||
// @Description Deletes non-whitelist rules by scope and instance key. Returns a taskID immediately; results are written to the task log.
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleDelete true "request"
|
|
||||||
// @Success 200 {object} dto.FirewallRuleDeleteResponse
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/delete [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除防火墙规则","formatEN":"delete firewall rules"}
|
|
||||||
func (b *BaseApi) DeleteFirewallRules(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := firewallService.Delete(c.Request.Context(), request)
|
|
||||||
if err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Update a firewall rule
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["instanceKey"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新防火墙规则 [instanceKey]","formatEN":"update firewall rule [instanceKey]"}
|
|
||||||
func (b *BaseApi) UpdateFirewallRule(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallService.Update(c.Request.Context(), request); err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Reorder a firewall rule
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallRuleReorder true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Failure 400 {object} dto.Response
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/reorder [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["instanceKey"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"调整防火墙规则顺序 [instanceKey]","formatEN":"reorder firewall rule [instanceKey]"}
|
|
||||||
func (b *BaseApi) ReorderFirewallRule(c *gin.Context) {
|
|
||||||
var request dto.FirewallRuleReorder
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallService.Reorder(c.Request.Context(), request); err != nil {
|
|
||||||
handleFirewallRuleError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleFirewallRuleError(c *gin.Context, err error) {
|
|
||||||
var businessErr buserr.BusinessError
|
|
||||||
isBusinessError := errors.As(err, &businessErr)
|
|
||||||
switch {
|
|
||||||
case errors.Is(err, filter.ErrProtectedRule):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusBadRequest, "FW_LOCKOUT_RISK", "ErrInvalidParams", err)
|
|
||||||
case errors.Is(err, filter.ErrRuleStale):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusConflict, "FW_RULE_STALE", "ErrInvalidParams", err)
|
|
||||||
case errors.Is(err, filter.ErrUnsupportedScope), errors.Is(err, filter.ErrInvalidScope),
|
|
||||||
errors.Is(err, filter.ErrProviderUnavailable), errors.Is(err, filter.ErrAdapterUnavailable):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusBadRequest, "FW_SCOPE_UNSUPPORTED", "ErrInvalidParams", err)
|
|
||||||
case errors.Is(err, filter.ErrInvalidRule), errors.Is(err, filter.ErrRuleOperation):
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusBadRequest, "FW_RULE_UNSUPPORTED", "ErrInvalidParams", err)
|
|
||||||
case isBusinessError && businessErr.Msg == "ErrRecordExist":
|
|
||||||
c.JSON(http.StatusOK, dto.Response{Code: http.StatusConflict, ErrorCode: "FW_RULE_DUPLICATE", Message: err.Error()})
|
|
||||||
c.Abort()
|
|
||||||
case isBusinessError && businessErr.Msg == "ErrFirewallRuleConflict":
|
|
||||||
c.JSON(http.StatusOK, dto.Response{Code: http.StatusConflict, ErrorCode: "FW_RULE_CONFLICT", Message: err.Error()})
|
|
||||||
c.Abort()
|
|
||||||
case isBusinessError && businessErr.Msg == "ErrInvalidParams":
|
|
||||||
c.JSON(http.StatusOK, dto.Response{Code: http.StatusBadRequest, ErrorCode: "FW_RULE_UNSUPPORTED", Message: err.Error()})
|
|
||||||
c.Abort()
|
|
||||||
default:
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusInternalServerError, "FW_APPLY_FAILED", "ErrInternalServer", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Load firewall settings
|
|
||||||
// @Success 200 {object} dto.FirewallSettings
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings [get]
|
|
||||||
func (b *BaseApi) LoadFirewallSettings(c *gin.Context) {
|
|
||||||
data, err := firewallSettingService.Load(c.Request.Context())
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Create firewall port whitelist rules
|
|
||||||
// @Description Saves whitelist configuration and applies missing allowances; existing rules are not removed.
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallPortWhitelistCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings/whitelist [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["rule"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建防火墙端口白名单","formatEN":"create firewall port whitelist"}
|
|
||||||
func (b *BaseApi) CreateFirewallPortWhitelist(c *gin.Context) {
|
|
||||||
var request dto.FirewallPortWhitelistCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallSettingService.CreatePortWhitelist(c.Request.Context(), request); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Update firewall port whitelist rules
|
|
||||||
// @Description Saves whitelist configuration and applies missing allowances; existing rules are not removed.
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallPortWhitelistUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings/whitelist/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["oldRule","rule"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"编辑防火墙端口白名单","formatEN":"update firewall port whitelist"}
|
|
||||||
func (b *BaseApi) UpdateFirewallPortWhitelist(c *gin.Context) {
|
|
||||||
var request dto.FirewallPortWhitelistUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallSettingService.UpdatePortWhitelist(c.Request.Context(), request); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Delete firewall port whitelist rules
|
|
||||||
// @Description Removes whitelist configuration; existing firewall rules are not removed.
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallPortWhitelistDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings/whitelist/delete [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["rules"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除防火墙端口白名单","formatEN":"delete firewall port whitelist"}
|
|
||||||
func (b *BaseApi) DeleteFirewallPortWhitelist(c *gin.Context) {
|
|
||||||
var request dto.FirewallPortWhitelistDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallSettingService.DeletePortWhitelist(c.Request.Context(), request); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Operate firewall backend
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallBackendOperation true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["subsystem","backend","operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"防火墙子系统 [subsystem] 后端 [operation] [backend]","formatEN":"[operation] firewall [subsystem] backend [backend]"}
|
|
||||||
func (b *BaseApi) OperateFirewallBackend(c *gin.Context) {
|
|
||||||
var request dto.FirewallBackendOperation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := firewallSettingService.Operate(c.Request.Context(), request); err != nil {
|
|
||||||
var businessErr buserr.BusinessError
|
|
||||||
if errors.As(err, &businessErr) && businessErr.Msg == "ErrFirewallBackendCleanupRequired" {
|
|
||||||
c.JSON(http.StatusOK, dto.Response{Code: http.StatusConflict, ErrorCode: "FW_BACKEND_CLEANUP_REQUIRED", Message: err.Error()})
|
|
||||||
c.Abort()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary List Docker port guard status and policies
|
|
||||||
// @Success 200 {object} dto.DockerPortGuardList
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/docker/ports [get]
|
|
||||||
func (b *BaseApi) ListDockerPortGuard(c *gin.Context) {
|
|
||||||
data, err := dockerPortGuardService.LoadOverview(c.Request.Context())
|
|
||||||
if err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary List Docker published ports
|
|
||||||
// @Success 200 {array} dto.DockerPortGuardContainer
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/docker/endpoints [get]
|
|
||||||
func (b *BaseApi) ListDockerPublishedPorts(c *gin.Context) {
|
|
||||||
data, err := dockerPortGuardService.LoadPublishedPorts(c.Request.Context())
|
|
||||||
if err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Operate Docker port guard
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.DockerPortGuardOperation true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/docker/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] Docker 端口防护","formatEN":"[operation] Docker port guard"}
|
|
||||||
func (b *BaseApi) OperateDockerPortGuard(c *gin.Context) {
|
|
||||||
var request dto.DockerPortGuardOperation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if request.Operation == "initialize" {
|
|
||||||
result, err := dockerPortGuardService.QueueInitialization(request)
|
|
||||||
if err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := dockerPortGuardService.Operate(c.Request.Context(), request); err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Delete Docker port guard policies
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.DockerPortGuardPolicyBatchDelete true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/docker/policies/delete/batch [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["uuids"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除 Docker 端口防护策略 [uuids]","formatEN":"delete Docker port guard policies [uuids]"}
|
|
||||||
func (b *BaseApi) DeleteDockerPortGuardPolicies(c *gin.Context) {
|
|
||||||
var request dto.DockerPortGuardPolicyBatchDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := dockerPortGuardService.DeletePolicies(request)
|
|
||||||
if err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Batch upsert Docker port guard policies
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.DockerPortGuardPolicyBatch true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/docker/policies/batch [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"批量更新 Docker 端口防护策略","formatEN":"batch update Docker port guard policies"}
|
|
||||||
func (b *BaseApi) UpsertDockerPortGuardPolicies(c *gin.Context) {
|
|
||||||
var request dto.DockerPortGuardPolicyBatch
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := dockerPortGuardService.UpsertPolicies(request)
|
|
||||||
if err != nil {
|
|
||||||
handleDockerPortGuardError(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleDockerPortGuardError(c *gin.Context, err error) {
|
|
||||||
var businessErr buserr.BusinessError
|
|
||||||
if errors.As(err, &businessErr) {
|
|
||||||
code, errorCode := http.StatusInternalServerError, ""
|
|
||||||
switch businessErr.Msg {
|
|
||||||
case "ErrDockerIptablesChainUnavailable":
|
|
||||||
code, errorCode = http.StatusServiceUnavailable, "FW_DOCKER_IPTABLES_CHAIN_UNAVAILABLE"
|
|
||||||
case "ErrDockerNftablesChainUnavailable":
|
|
||||||
code, errorCode = http.StatusServiceUnavailable, "FW_DOCKER_NFTABLES_CHAIN_UNAVAILABLE"
|
|
||||||
case "ErrInvalidParams":
|
|
||||||
code, errorCode = http.StatusBadRequest, "FW_DOCKER_GUARD_INVALID"
|
|
||||||
case "ErrDockerFailed":
|
|
||||||
code, errorCode = http.StatusServiceUnavailable, "FW_DOCKER_UNAVAILABLE"
|
|
||||||
}
|
|
||||||
if errorCode != "" {
|
|
||||||
c.JSON(http.StatusOK, dto.Response{Code: code, ErrorCode: errorCode, Message: err.Error()})
|
|
||||||
c.Abort()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if errors.Is(err, docker.ErrUnavailable) {
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusServiceUnavailable, "FW_DOCKER_UNAVAILABLE", "ErrDockerFailed", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.ErrorWithBusinessCode(c, http.StatusInternalServerError, "FW_DOCKER_GUARD_FAILED", "ErrInternalServer", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary List firewall rule backups
|
|
||||||
// @Param subsystem query string false "Firewall subsystem" Enums(system,forwarding,docker) default(system)
|
|
||||||
// @Success 200 {object} dto.FirewallRuleBackups
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/rules/backups [get]
|
|
||||||
func (b *BaseApi) ListFirewallRuleBackups(c *gin.Context) {
|
|
||||||
result, err := firewallService.ListRuleBackups(c.Request.Context(), c.DefaultQuery("subsystem", "system"))
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Initialize, repair or bind one firewall address family
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallFamilyOperation true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/family/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["subsystem","family","operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] [subsystem] [family] 防火墙链","formatEN":"[operation] [subsystem] [family] firewall chains"}
|
|
||||||
func (b *BaseApi) OperateFirewallFamily(c *gin.Context) {
|
|
||||||
var request dto.FirewallFamilyOperation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := firewallSettingService.OperateFamily(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Firewall
|
|
||||||
// @Summary Update firewall IPv6 support
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FirewallIPv6Operation true "request"
|
|
||||||
// @Success 200 {object} dto.FilterChainOperationResponse
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/firewall/settings/ipv6 [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["status"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"设置防火墙 IPv6 支持为 [status]","formatEN":"Set firewall IPv6 support to [status]"}
|
|
||||||
func (b *BaseApi) OperateFirewallIPv6(c *gin.Context) {
|
|
||||||
var request dto.FirewallIPv6Operation
|
|
||||||
if err := helper.CheckBindAndValidate(&request, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
result, err := firewallSettingService.OperateIPv6(request)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, result)
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/ai_tools/accelerator"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags AI
|
|
||||||
// @Summary Load gpu / xpu info
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/gpu/load [get]
|
|
||||||
func (b *BaseApi) LoadGpuInfo(c *gin.Context) {
|
|
||||||
ok, client := accelerator.New()
|
|
||||||
if ok {
|
|
||||||
snapshot, err := client.Collect(c.Request.Context())
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if warning := snapshot.Warning(); warning != nil {
|
|
||||||
global.LOG.Warnf("load realtime accelerator data partially failed, err: %v", warning)
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, &snapshot.Info)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, &accelerator.Info{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags AI
|
|
||||||
// @Summary Get CPU options
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/gpu/options [get]
|
|
||||||
func (b *BaseApi) GetCPUOptions(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, monitorService.LoadGPUOptions())
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Load monitor data
|
|
||||||
// @Param request body dto.MonitorGPUSearch true "request"
|
|
||||||
// @Success 200 {object} dto.MonitorGPUData
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/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)
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Health
|
|
||||||
// @Summary Check health
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /health/check [get]
|
|
||||||
func (b *BaseApi) CheckHealth(c *gin.Context) {
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
@@ -1,186 +0,0 @@
|
|||||||
package helper
|
|
||||||
|
|
||||||
import (
|
|
||||||
"compress/gzip"
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/constant"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/i18n"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
|
||||||
|
|
||||||
func ErrorWithDetail(ctx *gin.Context, code int, msgKey string, err error) {
|
|
||||||
res := dto.Response{
|
|
||||||
Code: code,
|
|
||||||
Message: "",
|
|
||||||
}
|
|
||||||
res.Message = i18n.GetMsgWithDetail(msgKey, err.Error())
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
ctx.Abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func ErrorWithBusinessCode(ctx *gin.Context, code int, businessCode, msgKey string, err error) {
|
|
||||||
res := dto.Response{
|
|
||||||
Code: code,
|
|
||||||
ErrorCode: businessCode,
|
|
||||||
Message: i18n.GetMsgWithDetail(msgKey, err.Error()),
|
|
||||||
}
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
ctx.Abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func ErrorWithDetailAndData(ctx *gin.Context, code int, msgKey string, err error, data interface{}) {
|
|
||||||
res := dto.Response{
|
|
||||||
Code: code,
|
|
||||||
Data: data,
|
|
||||||
}
|
|
||||||
res.Message = i18n.GetMsgWithDetail(msgKey, err.Error())
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
ctx.Abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func InternalServer(ctx *gin.Context, err error) {
|
|
||||||
ErrorWithDetail(ctx, http.StatusInternalServerError, "ErrInternalServer", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func BadRequest(ctx *gin.Context, err error) {
|
|
||||||
ErrorWithDetail(ctx, http.StatusBadRequest, "ErrInvalidParams", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func SuccessWithData(ctx *gin.Context, data interface{}) {
|
|
||||||
if data == nil {
|
|
||||||
data = gin.H{}
|
|
||||||
}
|
|
||||||
res := dto.Response{
|
|
||||||
Code: http.StatusOK,
|
|
||||||
Data: data,
|
|
||||||
}
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
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) {
|
|
||||||
res := dto.Response{
|
|
||||||
Code: http.StatusOK,
|
|
||||||
Message: "success",
|
|
||||||
}
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
ctx.Abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func SuccessWithMsg(ctx *gin.Context, msg string) {
|
|
||||||
res := dto.Response{
|
|
||||||
Code: http.StatusOK,
|
|
||||||
Message: msg,
|
|
||||||
}
|
|
||||||
ctx.JSON(http.StatusOK, res)
|
|
||||||
ctx.Abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetParamID(c *gin.Context) (uint, error) {
|
|
||||||
idParam, ok := c.Params.Get("id")
|
|
||||||
if !ok {
|
|
||||||
return 0, errors.New("error id in path")
|
|
||||||
}
|
|
||||||
intNum, _ := strconv.Atoi(idParam)
|
|
||||||
return uint(intNum), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetIntParamByKey(c *gin.Context, key string) (uint, error) {
|
|
||||||
idParam, ok := c.Params.Get(key)
|
|
||||||
if !ok {
|
|
||||||
return 0, fmt.Errorf("error %s in path", key)
|
|
||||||
}
|
|
||||||
intNum, _ := strconv.Atoi(idParam)
|
|
||||||
return uint(intNum), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetStrParamByKey(c *gin.Context, key string) (string, error) {
|
|
||||||
idParam, ok := c.Params.Get(key)
|
|
||||||
if !ok {
|
|
||||||
return "", fmt.Errorf("error %s in path", key)
|
|
||||||
}
|
|
||||||
return idParam, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetTxAndContext() (tx *gorm.DB, ctx context.Context) {
|
|
||||||
tx = global.DB.Begin()
|
|
||||||
ctx = context.WithValue(context.Background(), constant.DB, tx)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func CheckBindAndValidate(req interface{}, c *gin.Context) error {
|
|
||||||
if err := c.ShouldBindJSON(req); err != nil {
|
|
||||||
ErrorWithDetail(c, http.StatusBadRequest, "ErrInvalidParams", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := global.VALID.Struct(req); err != nil {
|
|
||||||
ErrorWithDetail(c, http.StatusBadRequest, "ErrInvalidParams", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func CheckBind(req interface{}, c *gin.Context) error {
|
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
|
||||||
ErrorWithDetail(c, http.StatusBadRequest, "ErrInvalidParams", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetParamInt32(paramName string, c *gin.Context) (int32, error) {
|
|
||||||
idParam, ok := c.Params.Get(paramName)
|
|
||||||
if !ok {
|
|
||||||
return 0, errors.New("error id in path")
|
|
||||||
}
|
|
||||||
intNum, _ := strconv.Atoi(idParam)
|
|
||||||
return int32(intNum), nil
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
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 Logs
|
|
||||||
// @Summary Load system log files
|
|
||||||
// @Success 200 {array} string
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/system/files [get]
|
|
||||||
func (b *BaseApi) GetSystemFiles(c *gin.Context) {
|
|
||||||
data, err := logService.ListSystemLogFile()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Logs
|
|
||||||
// @Summary Get host system log status
|
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {object} dto.SystemLogStatus
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/system/status [get]
|
|
||||||
func (b *BaseApi) GetSystemLogStatus(c *gin.Context) {
|
|
||||||
data, err := logService.GetSystemLogStatus()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Logs
|
|
||||||
// @Summary Read host logs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SystemLogReq true "request"
|
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {object} dto.SystemLogRes
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/system/read [post]
|
|
||||||
func (b *BaseApi) ReadSystemLog(c *gin.Context) {
|
|
||||||
var req dto.SystemLogReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := logService.ReadSystemLog(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Logs
|
|
||||||
// @Summary List running host services
|
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {array} string
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/system/services [get]
|
|
||||||
func (b *BaseApi) ListRunningServices(c *gin.Context) {
|
|
||||||
data, err := logService.ListRunningServices()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
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 Monitor
|
|
||||||
// @Summary Load monitor data
|
|
||||||
// @Param request body dto.MonitorSearch true "request"
|
|
||||||
// @Success 200 {array} dto.MonitorData
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/search [post]
|
|
||||||
func (b *BaseApi) LoadMonitor(c *gin.Context) {
|
|
||||||
var req dto.MonitorSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err := monitorService.LoadMonitorData(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithDataGzipped(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Clean host or GPU monitor data
|
|
||||||
// @Param request body dto.MonitorClean true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/clean [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["type"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清空 [type] 监控数据","formatEN":"clean [type] monitoring data"}
|
|
||||||
func (b *BaseApi) CleanMonitor(c *gin.Context) {
|
|
||||||
var req dto.MonitorClean
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := monitorService.CleanData(req.Type); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Load monitor setting
|
|
||||||
// @Success 200 {object} dto.MonitorSetting
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/setting [get]
|
|
||||||
func (b *BaseApi) LoadMonitorSetting(c *gin.Context) {
|
|
||||||
setting, err := monitorService.LoadSetting()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, setting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Update monitor setting
|
|
||||||
// @Param request body dto.MonitorSettingUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/setting/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["key", "value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改默认监控网卡 [key]-[value]","formatEN":"update default monitor [key]-[value]"}
|
|
||||||
func (b *BaseApi) UpdateMonitorSetting(c *gin.Context) {
|
|
||||||
var req dto.MonitorSettingUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := monitorService.UpdateSetting(req.Key, req.Value); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Get network options
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/netoptions [get]
|
|
||||||
func (b *BaseApi) GetNetworkOptions(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, monitorService.LoadNetworkOptions())
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Monitor
|
|
||||||
// @Summary Get IO options
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/monitor/iooptions [get]
|
|
||||||
func (b *BaseApi) GetIOOptions(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, monitorService.LoadIOOptions())
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
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"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (b *BaseApi) LoadVLLMMonitor(c *gin.Context) {
|
|
||||||
var req dto.MonitorVLLMSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := monitorService.LoadVLLMMonitorData(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BaseApi) LoadVLLMCurrent(c *gin.Context) {
|
|
||||||
var req dto.MonitorVLLMCurrent
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := monitorService.LoadVLLMCurrent(c.Request.Context(), req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BaseApi) CleanVLLMMonitor(c *gin.Context) {
|
|
||||||
var req dto.MonitorVLLMClean
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := monitorService.CleanVLLMMonitor(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
|
||||||
websocket2 "github.com/1Panel-dev/1Panel/agent/utils/websocket"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Process
|
|
||||||
// @Summary Process ws
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /process/ws [get]
|
|
||||||
func (b *BaseApi) ProcessWs(c *gin.Context) {
|
|
||||||
if !websocket.IsWebSocketUpgrade(c.Request) {
|
|
||||||
helper.Success(c)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ws, err := wsUpgrade.Upgrade(c.Writer, c.Request, nil)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
wsClient := websocket2.NewWsClient("processClient", ws)
|
|
||||||
go wsClient.Read()
|
|
||||||
go wsClient.Write()
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Process
|
|
||||||
// @Summary Stop Process
|
|
||||||
// @Param request body request.ProcessReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /process/stop [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["PID"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"结束进程 [PID]","formatEN":"结束进程 [PID]"}
|
|
||||||
func (b *BaseApi) StopProcess(c *gin.Context) {
|
|
||||||
var req request.ProcessReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := processService.StopProcess(req); err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,580 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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/request"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary List runtimes
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.RuntimeSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/search [post]
|
|
||||||
func (b *BaseApi) SearchRuntimes(c *gin.Context) {
|
|
||||||
var req request.RuntimeSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, items, err := runtimeService.Page(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Total: total,
|
|
||||||
Items: items,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Create runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.RuntimeCreate true "request"
|
|
||||||
// @Success 200 {object} model.Runtime
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建运行环境 [name]","formatEN":"Create runtime [name]"}
|
|
||||||
func (b *BaseApi) CreateRuntime(c *gin.Context) {
|
|
||||||
var req request.RuntimeCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ssl, err := runtimeService.Create(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, ssl)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website
|
|
||||||
// @Summary Delete runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.RuntimeDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除运行环境 [id]","formatEN":"Delete runtime [id]"}
|
|
||||||
func (b *BaseApi) DeleteRuntime(c *gin.Context) {
|
|
||||||
var req request.RuntimeDelete
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.Delete(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website
|
|
||||||
// @Summary Delete runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200 {array} dto.AppResource
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Param id path integer true "id"
|
|
||||||
// @Router /runtimes/installed/delete/check/:id [get]
|
|
||||||
func (b *BaseApi) DeleteRuntimeCheck(c *gin.Context) {
|
|
||||||
runTimeId, err := helper.GetIntParamByKey(c, "id")
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
checkData, err := runtimeService.DeleteCheck(runTimeId)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, checkData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Update runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.RuntimeUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新运行环境 [name]","formatEN":"Update runtime [name]"}
|
|
||||||
func (b *BaseApi) UpdateRuntime(c *gin.Context) {
|
|
||||||
var req request.RuntimeUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := runtimeService.Update(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {object} response.RuntimeDTO
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/:id [get]
|
|
||||||
func (b *BaseApi) GetRuntime(c *gin.Context) {
|
|
||||||
id, err := helper.GetIntParamByKey(c, "id")
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := runtimeService.Get(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get Node package scripts
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.NodePackageReq true "request"
|
|
||||||
// @Success 200 {array} response.PackageScripts
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/node/package [post]
|
|
||||||
func (b *BaseApi) GetNodePackageRunScript(c *gin.Context) {
|
|
||||||
var req request.NodePackageReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := runtimeService.GetNodePackageRunScript(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Operate runtime
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.RuntimeOperate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["ID"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"ID","isList":false,"db":"runtimes","output_column":"name","output_value":"name"}],"formatZH":"操作运行环境 [name]","formatEN":"Operate runtime [name]"}
|
|
||||||
func (b *BaseApi) OperateRuntime(c *gin.Context) {
|
|
||||||
var req request.RuntimeOperate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.OperateRuntime(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get Node modules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.NodeModuleReq true "request"
|
|
||||||
// @Success 200 {array} response.NodeModule
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/node/modules [post]
|
|
||||||
func (b *BaseApi) GetNodeModules(c *gin.Context) {
|
|
||||||
var req request.NodeModuleReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := runtimeService.GetNodeModules(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Operate Node modules
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.NodeModuleReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/node/modules/operate [post]
|
|
||||||
func (b *BaseApi) OperateNodeModules(c *gin.Context) {
|
|
||||||
var req request.NodeModuleOperateReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.OperateNodeModules(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Sync runtime status
|
|
||||||
// @Accept json
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Router /runtimes/sync [post]
|
|
||||||
func (b *BaseApi) SyncStatus(c *gin.Context) {
|
|
||||||
err := runtimeService.SyncRuntimeStatus()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get php runtime extension
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {object} response.PHPExtensionRes
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/:id/extensions [get]
|
|
||||||
func (b *BaseApi) GetRuntimeExtension(c *gin.Context) {
|
|
||||||
id, err := helper.GetIntParamByKey(c, "id")
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := runtimeService.GetPHPExtensions(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Install php extension
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPExtensionInstallReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/extensions/install [post]
|
|
||||||
func (b *BaseApi) InstallPHPExtension(c *gin.Context) {
|
|
||||||
var req request.PHPExtensionInstallReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.InstallPHPExtension(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary UnInstall php extension
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPExtensionInstallReq true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/extensions/uninstall [post]
|
|
||||||
func (b *BaseApi) UnInstallPHPExtension(c *gin.Context) {
|
|
||||||
var req request.PHPExtensionInstallReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.UnInstallPHPExtension(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Load php runtime conf
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {object} response.PHPConfig
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/config/:id [get]
|
|
||||||
func (b *BaseApi) GetPHPConfig(c *gin.Context) {
|
|
||||||
id, err := helper.GetParamID(c)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := runtimeService.GetPHPConfig(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Update runtime php conf
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPConfigUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/config [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] PHP 配置修改","formatEN":"[domain] PHP conf update"}
|
|
||||||
func (b *BaseApi) UpdatePHPConfig(c *gin.Context) {
|
|
||||||
var req request.PHPConfigUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := runtimeService.UpdatePHPConfig(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Update php conf file
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPFileUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/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":"php 配置修改 [domain]","formatEN":"Nginx conf update [domain]"}
|
|
||||||
func (b *BaseApi) UpdatePHPFile(c *gin.Context) {
|
|
||||||
var req request.PHPFileUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := runtimeService.UpdatePHPConfigFile(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get php conf file
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPFileReq true "request"
|
|
||||||
// @Success 200 {object} response.FileInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/file [post]
|
|
||||||
func (b *BaseApi) GetPHPConfigFile(c *gin.Context) {
|
|
||||||
var req request.PHPFileReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := runtimeService.GetPHPConfigFile(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Update fpm config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FPMConfig true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/fpm/config [post]
|
|
||||||
func (b *BaseApi) UpdateFPMConfig(c *gin.Context) {
|
|
||||||
var req request.FPMConfig
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := runtimeService.UpdateFPMConfig(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get fpm config
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {object} request.FPMConfig
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/fpm/config/:id [get]
|
|
||||||
func (b *BaseApi) GetFPMConfig(c *gin.Context) {
|
|
||||||
id, err := helper.GetParamID(c)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := runtimeService.GetFPMConfig(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get supervisor process
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {array} response.SupervisorProcessConfig
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/supervisor/process/:id [get]
|
|
||||||
func (b *BaseApi) GetSupervisorProcess(c *gin.Context) {
|
|
||||||
id, err := helper.GetParamID(c)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := runtimeService.GetSupervisorProcess(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Operate supervisor process
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPSupervisorProcessConfig true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/supervisor/process [post]
|
|
||||||
func (b *BaseApi) OperateSupervisorProcess(c *gin.Context) {
|
|
||||||
var req request.PHPSupervisorProcessConfig
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err := runtimeService.OperateSupervisorProcess(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Operate supervisor process file
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPSupervisorProcessFileReq true "request"
|
|
||||||
// @Success 200 {string} content
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/supervisor/process/file [post]
|
|
||||||
func (b *BaseApi) OperateSupervisorProcessFile(c *gin.Context) {
|
|
||||||
var req request.PHPSupervisorProcessFileReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := runtimeService.OperateSupervisorProcessFile(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Update PHP container config
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.PHPContainerConfig true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/container/update [post]
|
|
||||||
func (b *BaseApi) UpdatePHPContainer(c *gin.Context) {
|
|
||||||
var req request.PHPContainerConfig
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := runtimeService.UpdatePHPContainer(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Runtime
|
|
||||||
// @Summary Get PHP container config
|
|
||||||
// @Accept json
|
|
||||||
// @Param id path integer true "request"
|
|
||||||
// @Success 200 {object} request.PHPContainerConfig
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /runtimes/php/container/:id [get]
|
|
||||||
func (b *BaseApi) GetPHPContainerConfig(c *gin.Context) {
|
|
||||||
id, err := helper.GetParamID(c)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
data, err := runtimeService.GetPHPContainerConfig(id)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags RuntimeDiagnostics
|
|
||||||
// @Summary Load runtime diagnostics summary
|
|
||||||
// @Success 200 {object} dto.RuntimeDiagnosticsSummary
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/diagnostics/summary [get]
|
|
||||||
func (b *BaseApi) LoadRuntimeDiagnosticsSummary(c *gin.Context) {
|
|
||||||
data, err := runtimeDiagnosticsService.Summary()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags RuntimeDiagnostics
|
|
||||||
// @Summary Load grouped goroutine snapshot
|
|
||||||
// @Success 200 {object} dto.RuntimeGoroutineSnapshot
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/diagnostics/goroutines [get]
|
|
||||||
func (b *BaseApi) LoadRuntimeGoroutines(c *gin.Context) {
|
|
||||||
data, err := runtimeDiagnosticsService.Goroutines()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithDataGzipped(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags RuntimeDiagnostics
|
|
||||||
// @Summary Capture runtime profile
|
|
||||||
// @Param request body dto.RuntimeProfileCreate true "request"
|
|
||||||
// @Success 200 {file} file
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/diagnostics/profiles [post]
|
|
||||||
func (b *BaseApi) CreateRuntimeProfile(c *gin.Context) {
|
|
||||||
var req dto.RuntimeProfileCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
profile, err := runtimeDiagnosticsService.CreateProfile(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer os.Remove(profile.Path)
|
|
||||||
c.Header("Content-Disposition", `attachment; filename="`+profile.Name+`"`)
|
|
||||||
c.Header("Content-Type", "application/octet-stream")
|
|
||||||
c.File(profile.Path)
|
|
||||||
c.Abort()
|
|
||||||
}
|
|
||||||
@@ -1,303 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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/request"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/ssh"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Load system setting info
|
|
||||||
// @Success 200 {object} dto.SettingInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/search [post]
|
|
||||||
func (b *BaseApi) GetSettingInfo(c *gin.Context) {
|
|
||||||
setting, err := settingService.GetSettingInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, setting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Get terminal AI setting info
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/terminal/ai/search [post]
|
|
||||||
func (b *BaseApi) GetTerminalAISettingInfo(c *gin.Context) {
|
|
||||||
setting, err := settingService.GetTerminalAIInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, setting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Load system available status
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/search/available [get]
|
|
||||||
func (b *BaseApi) GetSystemAvailable(c *gin.Context) {
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Update system setting
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.AgentSettingUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["key","value"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改系统配置 [key] => [value]","formatEN":"update system setting [key] => [value]"}
|
|
||||||
func (b *BaseApi) UpdateSetting(c *gin.Context) {
|
|
||||||
var req dto.AgentSettingUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := settingService.Update(req.Key, req.Value); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Update terminal AI setting
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.TerminalAIInfo true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/terminal/ai/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["aiStatus","aiAccountId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新终端 AI 设置 [aiStatus][aiAccountId]","formatEN":"update terminal AI setting [aiStatus][aiAccountId]"}
|
|
||||||
func (b *BaseApi) UpdateTerminalAISetting(c *gin.Context) {
|
|
||||||
var req dto.TerminalAIInfo
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := settingService.UpdateTerminalAI(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Get file manage AI setting info
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/files/ai/search [post]
|
|
||||||
func (b *BaseApi) GetFileManageAISettingInfo(c *gin.Context) {
|
|
||||||
setting, err := settingService.GetFileManageAIInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, setting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Update file manage AI setting
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.FileManageAIInfo true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/files/ai/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["aiStatus","aiAccountId"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新文件管理 AI 设置 [aiStatus][aiAccountId]","formatEN":"update file manage AI setting [aiStatus][aiAccountId]"}
|
|
||||||
func (b *BaseApi) UpdateFileManageAISetting(c *gin.Context) {
|
|
||||||
var req dto.FileManageAIInfo
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := settingService.UpdateFileManageAI(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Load file history setting info
|
|
||||||
// @Success 200 {object} response.FileHistorySettingInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/file-history/search [post]
|
|
||||||
func (b *BaseApi) GetFileHistorySettingInfo(c *gin.Context) {
|
|
||||||
setting, err := settingService.GetFileHistorySettingInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, setting)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Update file history setting
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.FileHistorySettingUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/file-history/update [post]
|
|
||||||
func (b *BaseApi) UpdateFileHistorySetting(c *gin.Context) {
|
|
||||||
var req request.FileHistorySettingUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := settingService.UpdateFileHistorySetting(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Load website dir
|
|
||||||
// @Success 200 {string} path
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/website/dir [get]
|
|
||||||
func (b *BaseApi) LoadWebsiteDir(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, settingService.GetWebsiteDir())
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Load local backup dir
|
|
||||||
// @Success 200 {string} path
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/basedir [get]
|
|
||||||
func (b *BaseApi) LoadBaseDir(c *gin.Context) {
|
|
||||||
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())
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Check local conn
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/ssh/check [post]
|
|
||||||
func (b *BaseApi) CheckLocalConn(c *gin.Context) {
|
|
||||||
client, err := loadLocalConn()
|
|
||||||
if err == nil && client != nil {
|
|
||||||
client.Close()
|
|
||||||
}
|
|
||||||
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/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
|
|
||||||
// @Summary Check local conn info
|
|
||||||
// @Success 200 {boolean} isOk
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/ssh/check/info [post]
|
|
||||||
func (b *BaseApi) CheckLocalConnByInfo(c *gin.Context) {
|
|
||||||
var req dto.SSHConnData
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.SuccessWithData(c, settingService.TestConnByInfo(req))
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags System Setting
|
|
||||||
// @Summary Save local conn info
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /settings/ssh [post]
|
|
||||||
func (b *BaseApi) SaveLocalConn(c *gin.Context) {
|
|
||||||
var req dto.SSHConnData
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := settingService.SaveConnInfo(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadLocalConn() (*ssh.SSHClient, error) {
|
|
||||||
connInDB, err := settingService.GetLocalConnForSSH()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
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
|
|
||||||
// @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)
|
|
||||||
}
|
|
||||||
@@ -1,311 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/base64"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Load host SSH setting info
|
|
||||||
// @Success 200 {object} dto.SSHInfo
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/search [post]
|
|
||||||
func (b *BaseApi) GetSSHInfo(c *gin.Context) {
|
|
||||||
info, err := sshService.GetSSHInfo()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, info)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Operate SSH
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.Operate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["operation"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"[operation] SSH ","formatEN":"[operation] SSH"}
|
|
||||||
func (b *BaseApi) OperateSSH(c *gin.Context) {
|
|
||||||
var req dto.Operate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sshService.OperateSSH(req.Operation); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Update host SSH setting
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SSHUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/update [post]
|
|
||||||
// @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) {
|
|
||||||
var req dto.SSHUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sshService.Update(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Generate host SSH secret
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.RootCertOperate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/cert [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成 SSH 密钥 ","formatEN":"generate SSH secret"}
|
|
||||||
func (b *BaseApi) CreateRootCert(c *gin.Context) {
|
|
||||||
var req dto.RootCertOperate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := loadCertAfterDecrypt(&req); err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := sshService.CreateRootCert(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Update host SSH secret
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.RootCertOperate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/cert/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成 SSH 密钥 ","formatEN":"generate SSH secret"}
|
|
||||||
func (b *BaseApi) EditRootCert(c *gin.Context) {
|
|
||||||
var req dto.RootCertOperate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := loadCertAfterDecrypt(&req); err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := sshService.EditRootCert(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @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)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Load host SSH secret
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SearchWithPage true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/cert/search [post]
|
|
||||||
func (b *BaseApi) SearchRootCert(c *gin.Context) {
|
|
||||||
var req dto.SearchWithPage
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
total, data, err := sshService.SearchRootCerts(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
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
|
|
||||||
// @Summary Load host SSH logs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SearchSSHLog true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/log [post]
|
|
||||||
func (b *BaseApi) LoadSSHLogs(c *gin.Context) {
|
|
||||||
var req dto.SearchSSHLog
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 Clean host SSH logs
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/log/clean [post]
|
|
||||||
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFunctions":[],"formatZH":"清空 SSH 登录日志","formatEN":"clean SSH login logs"}
|
|
||||||
func (b *BaseApi) CleanSSHLogs(c *gin.Context) {
|
|
||||||
if err := sshService.CleanLog(); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @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 {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, data)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags SSH
|
|
||||||
// @Summary Update host SSH setting by file
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SSHConfUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/ssh/file/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["key"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"修改 SSH 配置文件 [key]","formatEN":"update SSH conf [key]"}
|
|
||||||
func (b *BaseApi) UpdateSSHByFile(c *gin.Context) {
|
|
||||||
var req dto.SSHConfUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sshService.UpdateByFile(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
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
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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/request"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/response"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags TaskLog
|
|
||||||
// @Summary Page task logs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.SearchTaskLogReq true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/tasks/search [post]
|
|
||||||
func (b *BaseApi) PageTasks(c *gin.Context) {
|
|
||||||
var req dto.SearchTaskLogReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, list, err := taskService.Page(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Items: list,
|
|
||||||
Total: total,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TaskLog
|
|
||||||
// @Summary Read task log by Line
|
|
||||||
// @Param request body request.TaskLogReadReq true "request"
|
|
||||||
// @Success 200 {object} response.FileLineContent
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/tasks/read [post]
|
|
||||||
func (b *BaseApi) ReadTaskLogByLine(c *gin.Context) {
|
|
||||||
var req request.TaskLogReadReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var res *response.FileLineContent
|
|
||||||
res, err := taskService.ReadByLine(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if res.TotalLines > 100 {
|
|
||||||
helper.SuccessWithDataGzipped(c, res)
|
|
||||||
} else {
|
|
||||||
helper.SuccessWithData(c, res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TaskLog
|
|
||||||
// @Summary Get the number of executing tasks
|
|
||||||
// @Success 200 {integer} int64
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /logs/tasks/executing/count [get]
|
|
||||||
func (b *BaseApi) CountExecutingTasks(c *gin.Context) {
|
|
||||||
count, err := taskService.CountExecutingTask()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, count)
|
|
||||||
}
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
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 TensorRT LLM
|
|
||||||
// @Summary Page TensorRT LLMs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.TensorRTLLMSearch true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/tensorrt/search [post]
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TensorRT LLM
|
|
||||||
// @Summary Create TensorRT LLM
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.TensorRTLLMCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/tensorrt/create [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 TensorRT LLM [name]","formatEN":"create TensorRT LLM [name]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TensorRT LLM
|
|
||||||
// @Summary Update TensorRT LLM
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.TensorRTLLMUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/tensorrt/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新 TensorRT LLM [id][name]","formatEN":"update TensorRT LLM [id][name]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TensorRT LLM
|
|
||||||
// @Summary Delete TensorRT LLM
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.TensorRTLLMDelete true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/tensorrt/delete [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除 TensorRT LLM [id]","formatEN":"delete TensorRT LLM [id]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags TensorRT LLM
|
|
||||||
// @Summary Operate TensorRT LLM
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.TensorRTLLMOperate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /ai/tensorrt/operate [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id","operate"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"操作 TensorRT LLM [id][operate]","formatEN":"operate TensorRT LLM [id][operate]"}
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
@@ -1,433 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/sha256"
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/hex"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"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/model"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/service"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/cmd"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/ssh"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/terminal"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/gorilla/websocket"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
gossh "golang.org/x/crypto/ssh"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Summary Ws local terminal
|
|
||||||
// @Param command query string false "command"
|
|
||||||
// @Param session query string false "session id to reattach"
|
|
||||||
// @Param terminalPersistent query boolean false "allow recovery after an unexpected disconnect"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/local [get]
|
|
||||||
func (b *BaseApi) WsLocalTerminal(c *gin.Context) {
|
|
||||||
b.runSSHSession(c, "local", loadLocalConn, c.DefaultQuery("command", ""))
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Summary Ws host SSH
|
|
||||||
// @Param id query integer false "id"
|
|
||||||
// @Param command query string false "command"
|
|
||||||
// @Param session query string false "session id to reattach"
|
|
||||||
// @Param title query string false "session title shown in the session list"
|
|
||||||
// @Param terminalPersistent query boolean false "allow recovery after an unexpected disconnect"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/ssh [get]
|
|
||||||
func (b *BaseApi) WsHostSSH(c *gin.Context) {
|
|
||||||
b.runSSHSession(c, "ssh", func() (*ssh.SSHClient, error) {
|
|
||||||
hostID, _ := strconv.Atoi(c.DefaultQuery("id", "0"))
|
|
||||||
if hostID <= 0 {
|
|
||||||
return nil, errors.New("missing host id")
|
|
||||||
}
|
|
||||||
host, err := service.GetHostInfo(uint(hostID))
|
|
||||||
return newHostSSHClient(host, err)
|
|
||||||
}, c.DefaultQuery("command", ""))
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Summary Ws container terminal
|
|
||||||
// @Param cols query integer false "cols"
|
|
||||||
// @Param rows query integer false "rows"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/container [get]
|
|
||||||
func (b *BaseApi) WsContainerTerminal(c *gin.Context) {
|
|
||||||
wsConn, cols, rows, ok := prepareTerminalSession(c)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer wsConn.Close()
|
|
||||||
identity, ok := loadTerminalIdentity(c)
|
|
||||||
if !ok {
|
|
||||||
_ = wshandleError(wsConn, errors.New("missing terminal identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
opts := terminal.SessionOptions{
|
|
||||||
Identity: identity,
|
|
||||||
Kind: "container",
|
|
||||||
Target: containerTerminalTarget(c),
|
|
||||||
Cols: cols,
|
|
||||||
Rows: rows,
|
|
||||||
}
|
|
||||||
if err := terminal.ServeCommand(wsConn, strings.TrimSpace(c.Query("session")), opts, func() (*terminal.LocalCommand, error) {
|
|
||||||
return loadContainerTerminalCommand(c)
|
|
||||||
}); err != nil {
|
|
||||||
_ = wshandleError(wsConn, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func containerTerminalTarget(c *gin.Context) string {
|
|
||||||
query := c.Request.URL.Query()
|
|
||||||
for _, key := range []string{"cols", "rows", "session", "terminalRevalidate"} {
|
|
||||||
query.Del(key)
|
|
||||||
}
|
|
||||||
sum := sha256.Sum256([]byte(query.Encode()))
|
|
||||||
return hex.EncodeToString(sum[:])
|
|
||||||
}
|
|
||||||
|
|
||||||
func prepareTerminalSession(c *gin.Context) (*websocket.Conn, int, int, bool) {
|
|
||||||
if !websocket.IsWebSocketUpgrade(c.Request) {
|
|
||||||
helper.Success(c)
|
|
||||||
return nil, 0, 0, false
|
|
||||||
}
|
|
||||||
wsConn, err := upGrader.Upgrade(c.Writer, c.Request, nil)
|
|
||||||
if err != nil {
|
|
||||||
global.LOG.Errorf("gin context http handler failed, err: %v", err)
|
|
||||||
return nil, 0, 0, false
|
|
||||||
}
|
|
||||||
|
|
||||||
if global.CONF.Base.IsDemo {
|
|
||||||
if wshandleError(wsConn, errors.New(" demo server, prohibit this operation!")) {
|
|
||||||
return nil, 0, 0, false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cols, err := strconv.Atoi(c.DefaultQuery("cols", "80"))
|
|
||||||
if wshandleError(wsConn, errors.WithMessage(err, "invalid param cols in request")) {
|
|
||||||
return nil, 0, 0, false
|
|
||||||
}
|
|
||||||
rows, err := strconv.Atoi(c.DefaultQuery("rows", "40"))
|
|
||||||
if wshandleError(wsConn, errors.WithMessage(err, "invalid param rows in request")) {
|
|
||||||
return nil, 0, 0, false
|
|
||||||
}
|
|
||||||
return wsConn, cols, rows, true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BaseApi) runSSHSession(c *gin.Context, kind string, connect func() (*ssh.SSHClient, error), command string) {
|
|
||||||
wsConn, cols, rows, ok := prepareTerminalSession(c)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer wsConn.Close()
|
|
||||||
identity, ok := loadTerminalIdentity(c)
|
|
||||||
if !ok {
|
|
||||||
_ = wshandleError(wsConn, errors.New("missing terminal identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
hostID := 0
|
|
||||||
if kind == "ssh" {
|
|
||||||
hostID, _ = strconv.Atoi(c.DefaultQuery("id", "0"))
|
|
||||||
}
|
|
||||||
opts := terminal.SessionOptions{
|
|
||||||
Identity: identity,
|
|
||||||
Kind: kind,
|
|
||||||
Title: sanitizeTerminalTitle(c.Query("title")),
|
|
||||||
Persistent: c.Query("terminalPersistent") == "true",
|
|
||||||
HostID: uint(max(hostID, 0)),
|
|
||||||
Cols: cols,
|
|
||||||
Rows: rows,
|
|
||||||
InitCmd: command,
|
|
||||||
}
|
|
||||||
err := terminal.Serve(wsConn, strings.TrimSpace(c.Query("session")), opts, func() (*gossh.Client, error) {
|
|
||||||
client, err := connect()
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessage(err, "failed to set up the connection. Please check the host information")
|
|
||||||
}
|
|
||||||
return client.Client, nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
_ = wshandleError(wsConn, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Summary List the caller's live terminal sessions
|
|
||||||
// @Success 200 {array} terminal.Info
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/sessions/search [post]
|
|
||||||
func (b *BaseApi) SearchTerminalSessions(c *gin.Context) {
|
|
||||||
identity, ok := loadTerminalIdentity(c)
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("missing terminal identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, terminal.List(identity))
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Summary Close a terminal session
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.TerminalSessionClose true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/sessions/close [post]
|
|
||||||
func (b *BaseApi) CloseTerminalSession(c *gin.Context) {
|
|
||||||
var req dto.TerminalSessionClose
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
identity, ok := loadTerminalIdentity(c)
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("missing terminal identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := terminal.CloseSession(req.ID, identity); err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Terminal
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /hosts/terminal/sessions/closeAll [post]
|
|
||||||
func (b *BaseApi) CloseAllTerminalSessions(c *gin.Context) {
|
|
||||||
identity, ok := loadTerminalIdentity(c)
|
|
||||||
if !ok {
|
|
||||||
helper.BadRequest(c, errors.New("missing terminal identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
terminal.Revoke("auth_session", identity.UserID, identity.AuthSessionID)
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BaseApi) RevokeTerminalSessions(c *gin.Context) {
|
|
||||||
var req dto.TerminalSessionRevoke
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (req.Scope == "auth_session" && (req.UserID == "" || req.AuthSessionID == "")) ||
|
|
||||||
(req.Scope == "user" && req.UserID == "") {
|
|
||||||
helper.BadRequest(c, errors.New("missing terminal revocation identity"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
terminal.Revoke(req.Scope, req.UserID, req.AuthSessionID)
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadTerminalIdentity(c *gin.Context) (terminal.Identity, bool) {
|
|
||||||
identity := terminal.Identity{
|
|
||||||
UserID: strings.TrimSpace(c.GetHeader(terminal.HeaderUserID)),
|
|
||||||
AuthSessionID: strings.TrimSpace(c.GetHeader(terminal.HeaderAuthSessionID)),
|
|
||||||
}
|
|
||||||
if value := c.GetHeader(terminal.HeaderAuthLeaseUntil); value != "" {
|
|
||||||
millis, err := strconv.ParseInt(value, 10, 64)
|
|
||||||
if err != nil || millis <= 0 {
|
|
||||||
return terminal.Identity{}, false
|
|
||||||
}
|
|
||||||
identity.AuthLeaseUntil = time.UnixMilli(millis)
|
|
||||||
if maximum := time.Now().Add(90 * time.Second); identity.AuthLeaseUntil.After(maximum) {
|
|
||||||
identity.AuthLeaseUntil = maximum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return identity, identity.Valid()
|
|
||||||
}
|
|
||||||
|
|
||||||
// sanitizeTerminalTitle keeps the title a short single line.
|
|
||||||
func sanitizeTerminalTitle(title string) string {
|
|
||||||
title = strings.Join(strings.Fields(title), " ")
|
|
||||||
if r := []rune(title); len(r) > 64 {
|
|
||||||
title = string(r[:64])
|
|
||||||
}
|
|
||||||
return title
|
|
||||||
}
|
|
||||||
|
|
||||||
func closeTerminalConn(wsConn *websocket.Conn) {
|
|
||||||
dt := time.Now().Add(time.Second)
|
|
||||||
_ = wsConn.WriteControl(websocket.CloseMessage, nil, dt)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newHostSSHClient(host *model.Host, err error) (*ssh.SSHClient, error) {
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessage(err, "load host info by id failed")
|
|
||||||
}
|
|
||||||
connInfo := ssh.ConnInfo{
|
|
||||||
Addr: host.Addr,
|
|
||||||
Port: int(host.Port),
|
|
||||||
User: host.User,
|
|
||||||
AuthMode: host.AuthMode,
|
|
||||||
Password: host.Password,
|
|
||||||
PrivateKey: []byte(host.PrivateKey),
|
|
||||||
}
|
|
||||||
if len(host.PassPhrase) != 0 {
|
|
||||||
connInfo.PassPhrase = []byte(host.PassPhrase)
|
|
||||||
}
|
|
||||||
return ssh.NewClient(connInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadContainerTerminalCommand(c *gin.Context) (*terminal.LocalCommand, error) {
|
|
||||||
source := c.Query("source")
|
|
||||||
var (
|
|
||||||
initCmd []string
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
switch source {
|
|
||||||
case "redis", "redis-cluster":
|
|
||||||
initCmd, err = loadRedisInitCmd(c, source)
|
|
||||||
case "ollama":
|
|
||||||
initCmd, err = loadOllamaInitCmd(c)
|
|
||||||
case "container":
|
|
||||||
initCmd, err = loadContainerInitCmd(c)
|
|
||||||
case "database":
|
|
||||||
initCmd, err = loadDatabaseInitCmd(c)
|
|
||||||
default:
|
|
||||||
return nil, fmt.Errorf("not support such source %s", source)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return terminal.NewCommand("docker", initCmd...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadRedisInitCmd(c *gin.Context, redisType string) ([]string, error) {
|
|
||||||
name := c.Query("name")
|
|
||||||
from := c.Query("from")
|
|
||||||
commands := []string{"exec", "-it"}
|
|
||||||
database, err := databaseService.Get(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("no such database in db, err: %v", err)
|
|
||||||
}
|
|
||||||
if from == "local" {
|
|
||||||
redisInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: name, Type: redisType})
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("no such app in db, err: %v", err)
|
|
||||||
}
|
|
||||||
name = redisInfo.ContainerName
|
|
||||||
commands = append(commands, []string{name, "redis-cli"}...)
|
|
||||||
if len(database.Password) != 0 {
|
|
||||||
commands = append(commands, []string{"-a", database.Password, "--no-auth-warning"}...)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
name = "1Panel-redis-cli-tools"
|
|
||||||
commands = append(commands, []string{name, "redis-cli", "-h", database.Address, "-p", fmt.Sprintf("%v", database.Port)}...)
|
|
||||||
if len(database.Password) != 0 {
|
|
||||||
commands = append(commands, []string{"-a", database.Password, "--no-auth-warning"}...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return commands, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadOllamaInitCmd(c *gin.Context) ([]string, error) {
|
|
||||||
name := c.Query("name")
|
|
||||||
if cmd.CheckIllegal(name) {
|
|
||||||
return nil, fmt.Errorf("ollama model %s contains illegal characters", name)
|
|
||||||
}
|
|
||||||
ollamaInfo, err := appInstallService.LoadConnInfo(dto.OperationWithNameAndType{Name: "", Type: "ollama"})
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("no such app in db, err: %v", err)
|
|
||||||
}
|
|
||||||
containerName := ollamaInfo.ContainerName
|
|
||||||
return []string{"exec", "-it", containerName, "ollama", "run", name}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadContainerInitCmd(c *gin.Context) ([]string, error) {
|
|
||||||
containerID := c.Query("containerid")
|
|
||||||
command := c.Query("command")
|
|
||||||
user := c.Query("user")
|
|
||||||
if cmd.CheckIllegal(user, containerID, command) {
|
|
||||||
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 {
|
|
||||||
return nil, fmt.Errorf("error param of command: %s or containerID: %s", command, containerID)
|
|
||||||
}
|
|
||||||
commands := []string{"exec", "-it", containerID, command}
|
|
||||||
if len(user) != 0 {
|
|
||||||
commands = []string{"exec", "-it", "-u", user, containerID, command}
|
|
||||||
}
|
|
||||||
|
|
||||||
return commands, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadDatabaseInitCmd(c *gin.Context) ([]string, error) {
|
|
||||||
database := c.Query("database")
|
|
||||||
databaseType := c.Query("databaseType")
|
|
||||||
if 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)
|
|
||||||
}
|
|
||||||
if len(databaseConn.ContainerName) == 0 {
|
|
||||||
return nil, fmt.Errorf("no such database container for database: %s or database type: %s", database, databaseType)
|
|
||||||
}
|
|
||||||
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 "mongodb":
|
|
||||||
commands = append(commands, []string{
|
|
||||||
"mongosh",
|
|
||||||
"--username", databaseConn.Username,
|
|
||||||
"--password", databaseConn.Password,
|
|
||||||
"--authenticationDatabase", "admin",
|
|
||||||
}...)
|
|
||||||
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 {
|
|
||||||
if err != nil {
|
|
||||||
global.LOG.Errorf("handler ws faled:, err: %v", err)
|
|
||||||
dt := time.Now().Add(time.Second)
|
|
||||||
if ctlerr := ws.WriteControl(websocket.CloseMessage, []byte(err.Error()), dt); ctlerr != nil {
|
|
||||||
wsData, err := json.Marshal(terminal.WsMsg{
|
|
||||||
Type: terminal.WsMsgCmd,
|
|
||||||
Data: base64.StdEncoding.EncodeToString([]byte(err.Error())),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
_ = ws.WriteMessage(websocket.TextMessage, []byte("{\"type\":\"cmd\",\"data\":\"failed to encoding to json\"}"))
|
|
||||||
} else {
|
|
||||||
_ = ws.WriteMessage(websocket.TextMessage, wsData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
var upGrader = websocket.Upgrader{
|
|
||||||
ReadBufferSize: 4096,
|
|
||||||
WriteBufferSize: 16384,
|
|
||||||
CheckOrigin: func(r *http.Request) bool {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/api/v2/helper"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (b *BaseApi) TerminalCapabilities(c *gin.Context) {
|
|
||||||
helper.SuccessWithData(c, gin.H{"apiKeyLeaseVersion": 1})
|
|
||||||
}
|
|
||||||
@@ -1,259 +0,0 @@
|
|||||||
package v2
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
|
|
||||||
"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/request"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Page website templates
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsiteTemplateSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/search [post]
|
|
||||||
func (b *BaseApi) PageWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req request.WebsiteTemplateSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, templates, err := websiteTemplateService.PageTemplate(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Total: total,
|
|
||||||
Items: templates,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Create website template
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsiteTemplateCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建网站模板 [name]","formatEN":"Create website template [name]"}
|
|
||||||
func (b *BaseApi) CreateWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req request.WebsiteTemplateCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := websiteTemplateService.CreateTemplate(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Update website template
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsiteTemplateUpdate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/update [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"更新网站模板 [name]","formatEN":"Update website template [name]"}
|
|
||||||
func (b *BaseApi) UpdateWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req request.WebsiteTemplateUpdate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := websiteTemplateService.UpdateTemplate(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Delete website template
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperateByID true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"website_templates","output_column":"name","output_value":"name"}],"formatZH":"删除网站模板 [name]","formatEN":"Delete website template [name]"}
|
|
||||||
func (b *BaseApi) DeleteWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req dto.OperateByID
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := websiteTemplateService.DeleteTemplate(req.ID); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Get website template
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperateByID true "request"
|
|
||||||
// @Success 200 {object} response.WebsiteTemplateDTO
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/get [post]
|
|
||||||
func (b *BaseApi) GetWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req dto.OperateByID
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
template, err := websiteTemplateService.GetTemplate(req.ID)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, template)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Upload website template zip
|
|
||||||
// @Accept multipart/form-data
|
|
||||||
// @Param file formData file true "file"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/upload [post]
|
|
||||||
func (b *BaseApi) UploadTemplateZip(c *gin.Context) {
|
|
||||||
fileHeader, err := c.FormFile("file")
|
|
||||||
if err != nil {
|
|
||||||
helper.BadRequest(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
file, err := fileHeader.Open()
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
content, err := io.ReadAll(file)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
filePath, variables, err := websiteTemplateService.SaveUploadZip(fileHeader.Filename, content)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, gin.H{"filePath": filePath, "variables": variables})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Preview website template
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsitePreviewReq true "request"
|
|
||||||
// @Success 200 {object} response.WebsitePreviewDTO
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/preview [post]
|
|
||||||
func (b *BaseApi) PreviewWebsiteTemplate(c *gin.Context) {
|
|
||||||
var req request.WebsitePreviewReq
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
preview, err := websiteTemplateService.Preview(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, preview)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Page website template outputs
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsiteTemplateOutputSearch true "request"
|
|
||||||
// @Success 200 {object} dto.PageResult
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/outputs/search [post]
|
|
||||||
func (b *BaseApi) PageWebsiteTemplateOutput(c *gin.Context) {
|
|
||||||
var req request.WebsiteTemplateOutputSearch
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
total, outputs, err := websiteTemplateService.PageOutput(req)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, dto.PageResult{
|
|
||||||
Total: total,
|
|
||||||
Items: outputs,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Create website template output
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body request.WebsiteTemplateOutputCreate true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/outputs [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"生成模板产物 [name]","formatEN":"Generate template output [name]"}
|
|
||||||
func (b *BaseApi) CreateWebsiteTemplateOutput(c *gin.Context) {
|
|
||||||
var req request.WebsiteTemplateOutputCreate
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := websiteTemplateService.CreateOutput(req); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Delete website template output
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperateByID true "request"
|
|
||||||
// @Success 200
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/outputs/del [post]
|
|
||||||
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"id","isList":false,"db":"website_template_outputs","output_column":"name","output_value":"name"}],"formatZH":"删除模板产物 [name]","formatEN":"Delete template output [name]"}
|
|
||||||
func (b *BaseApi) DeleteWebsiteTemplateOutput(c *gin.Context) {
|
|
||||||
var req dto.OperateByID
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err := websiteTemplateService.DeleteOutput(req.ID); err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.Success(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Tags Website Template
|
|
||||||
// @Summary Get website template output
|
|
||||||
// @Accept json
|
|
||||||
// @Param request body dto.OperateByID true "request"
|
|
||||||
// @Success 200 {object} response.WebsiteTemplateOutputDTO
|
|
||||||
// @Security ApiKeyAuth
|
|
||||||
// @Security Timestamp
|
|
||||||
// @Router /websites/templates/outputs/get [post]
|
|
||||||
func (b *BaseApi) GetWebsiteTemplateOutput(c *gin.Context) {
|
|
||||||
var req dto.OperateByID
|
|
||||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
output, err := websiteTemplateService.GetOutput(req.ID)
|
|
||||||
if err != nil {
|
|
||||||
helper.InternalServer(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
helper.SuccessWithData(c, output)
|
|
||||||
}
|
|
||||||
@@ -1,817 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type AgentCreateReq struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
AppVersion string `json:"appVersion" validate:"required"`
|
|
||||||
WebUIPort int `json:"webUIPort" validate:"required,min=1,max=65535"`
|
|
||||||
BridgePort int `json:"bridgePort"`
|
|
||||||
AllowedOrigins []string `json:"allowedOrigins"`
|
|
||||||
AgentType string `json:"agentType" validate:"required,oneof=openclaw copaw hermes-agent"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
AccountID uint `json:"accountId"`
|
|
||||||
Token string `json:"token"`
|
|
||||||
DashboardUsername string `json:"dashboardUsername"`
|
|
||||||
DashboardPassword string `json:"dashboardPassword"`
|
|
||||||
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 AgentBatchInstallReq struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
AppVersion string `json:"appVersion" validate:"required"`
|
|
||||||
WebUIPort int `json:"webUIPort" validate:"required,min=1,max=65535"`
|
|
||||||
BridgePort int `json:"bridgePort"`
|
|
||||||
AllowedOrigins []string `json:"allowedOrigins"`
|
|
||||||
AgentType string `json:"agentType" validate:"required,oneof=openclaw copaw hermes-agent"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
AccountID uint `json:"accountId"`
|
|
||||||
Token string `json:"token"`
|
|
||||||
DashboardUsername string `json:"dashboardUsername"`
|
|
||||||
DashboardPassword string `json:"dashboardPassword"`
|
|
||||||
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"`
|
|
||||||
MasterAccountID uint `json:"masterAccountId"`
|
|
||||||
FallbackAccessHost string `json:"fallbackAccessHost"`
|
|
||||||
AccountSnapshot AgentAccountInfo `json:"accountSnapshot"`
|
|
||||||
AccountModels []AgentAccountModel `json:"accountModels"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchUpgradeReq struct {
|
|
||||||
AgentType string `json:"agentType" validate:"required,oneof=openclaw copaw hermes-agent"`
|
|
||||||
TargetVersion string `json:"targetVersion" validate:"required"`
|
|
||||||
Backup bool `json:"backup"`
|
|
||||||
PullImage bool `json:"pullImage"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchUpgradeResult struct {
|
|
||||||
AgentID uint `json:"agentID"`
|
|
||||||
AgentName string `json:"agentName"`
|
|
||||||
AppInstallID uint `json:"appInstallID"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
Skipped bool `json:"skipped"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchSkillInstallReq struct {
|
|
||||||
AgentType string `json:"agentType" validate:"required,oneof=openclaw hermes-agent"`
|
|
||||||
SkillName string `json:"skillName" validate:"required"`
|
|
||||||
PackagePath string `json:"packagePath" validate:"required"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchSkillInstallResult struct {
|
|
||||||
AgentID uint `json:"agentID"`
|
|
||||||
AgentName string `json:"agentName"`
|
|
||||||
AppInstallID uint `json:"appInstallID"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
Skipped bool `json:"skipped"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchOperateReq struct {
|
|
||||||
AgentType string `json:"agentType" validate:"required,oneof=openclaw copaw hermes-agent"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=start stop restart delete"`
|
|
||||||
ForceDelete bool `json:"forceDelete"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentBatchOperateResult struct {
|
|
||||||
AgentID uint `json:"agentID"`
|
|
||||||
AgentName string `json:"agentName"`
|
|
||||||
AppInstallID uint `json:"appInstallID"`
|
|
||||||
Success bool `json:"success"`
|
|
||||||
Skipped bool `json:"skipped"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentItem struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
AgentType string `json:"agentType"`
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
ProviderName string `json:"providerName"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
APIType string `json:"apiType"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
APIKey string `json:"apiKey"`
|
|
||||||
Token string `json:"token"`
|
|
||||||
DashboardUsername string `json:"dashboardUsername"`
|
|
||||||
DashboardPassword string `json:"dashboardPassword"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
AppInstallID uint `json:"appInstallId"`
|
|
||||||
WebsiteID uint `json:"websiteId"`
|
|
||||||
WebsitePrimaryDomain string `json:"websitePrimaryDomain"`
|
|
||||||
WebsiteType string `json:"websiteType"`
|
|
||||||
WebsiteProtocol string `json:"websiteProtocol"`
|
|
||||||
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 AgentRemarkUpdateReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentWebsiteBindReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentModelConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
|
||||||
Model string `json:"model" validate:"required"`
|
|
||||||
Fallbacks []string `json:"fallbacks"`
|
|
||||||
Metadata []AgentModelMetadata `json:"metadata" validate:"dive"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentModelConfig struct {
|
|
||||||
AccountID uint `json:"accountId"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
Fallbacks []string `json:"fallbacks"`
|
|
||||||
Metadata []AgentModelMetadata `json:"metadata"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentModelMetadata struct {
|
|
||||||
Model string `json:"model" validate:"required"`
|
|
||||||
InputMode string `json:"inputMode" validate:"required,oneof=auto text image"`
|
|
||||||
ContextWindow int `json:"contextWindow" validate:"min=0"`
|
|
||||||
MaxTokens int `json:"maxTokens" validate:"min=0"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentHermesChatSessionItem struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Title string `json:"title"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
MessageCount int64 `json:"messageCount"`
|
|
||||||
StartedAt string `json:"startedAt"`
|
|
||||||
LastActive string `json:"lastActive"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentOverviewReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentIDReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentHermesChatSessionRenameReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
Title string `json:"title" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentHermesChatSessionDeleteReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentOverview struct {
|
|
||||||
Snapshot AgentOverviewSnapshot `json:"snapshot"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleBinding struct {
|
|
||||||
Channel string `json:"channel" validate:"required"`
|
|
||||||
AccountID string `json:"accountId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleCreateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
Bindings []AgentRoleBinding `json:"bindings"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleCreateResp struct {
|
|
||||||
Output string `json:"output"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleDeleteReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleBindReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
Channel string `json:"channel" validate:"required"`
|
|
||||||
AccountID string `json:"accountId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentConfiguredAgentsReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleChannelsReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleChannelItem struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Bound bool `json:"bound"`
|
|
||||||
AccountIDs []string `json:"accountIds"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleMarkdownFilesReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Workspace string `json:"workspace" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentConfiguredAgentItem struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Workspace string `json:"workspace"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
AgentDir string `json:"agentDir"`
|
|
||||||
Bindings []AgentRoleBinding `json:"bindings"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleMarkdownFileItem struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleMarkdownFileUpdateItem struct {
|
|
||||||
Name string `json:"name" validate:"required,oneof=AGENTS.md SOUL.md USER.md IDENTITY.md TOOLS.md HEARTBEAT.md BOOT.md BOOTSTRAP.md"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentRoleMarkdownFilesUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Workspace string `json:"workspace" validate:"required"`
|
|
||||||
Restart bool `json:"restart"`
|
|
||||||
Files []AgentRoleMarkdownFileUpdateItem `json:"files" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentOverviewSnapshot struct {
|
|
||||||
ContainerStatus string `json:"containerStatus"`
|
|
||||||
AppVersion string `json:"appVersion"`
|
|
||||||
DefaultModel string `json:"defaultModel"`
|
|
||||||
ChannelCount int `json:"channelCount"`
|
|
||||||
SkillCount int `json:"skillCount"`
|
|
||||||
JobCount int `json:"jobCount"`
|
|
||||||
SessionCount int `json:"sessionCount"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModel struct {
|
|
||||||
RecordID uint `json:"recordId"`
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModelReq struct {
|
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModelDiscoverReq struct {
|
|
||||||
Provider string `json:"provider" validate:"required"`
|
|
||||||
BaseURL string `json:"baseURL" validate:"required"`
|
|
||||||
APIKey string `json:"apiKey" validate:"required"`
|
|
||||||
APIType string `json:"apiType" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModelCreateReq struct {
|
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
|
||||||
Model AgentAccountModel `json:"model" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModelUpdateReq struct {
|
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
|
||||||
Model AgentAccountModel `json:"model" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountModelDeleteReq struct {
|
|
||||||
AccountID uint `json:"accountId" validate:"required"`
|
|
||||||
RecordID uint `json:"recordId" 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"`
|
|
||||||
Models []AgentAccountModel `json:"models"`
|
|
||||||
APIType string `json:"apiType" validate:"required"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
VerifyModel string `json:"verifyModel"`
|
|
||||||
ValidateAvailability *bool `json:"validateAvailability"`
|
|
||||||
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"`
|
|
||||||
APIType string `json:"apiType" validate:"required"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
VerifyModel string `json:"verifyModel"`
|
|
||||||
ValidateAvailability *bool `json:"validateAvailability"`
|
|
||||||
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"`
|
|
||||||
APIType string `json:"apiType" validate:"required"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountDeleteReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountSearch struct {
|
|
||||||
PageInfo
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
APIType string `json:"apiType"`
|
|
||||||
TextOnly bool `json:"textOnly"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountProviderCountReq struct {
|
|
||||||
Providers []string `json:"providers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentAccountInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
MasterAccountID uint `json:"masterAccountId"`
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
ProviderName string `json:"providerName"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
APIKey string `json:"apiKey"`
|
|
||||||
RememberAPIKey bool `json:"rememberApiKey"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
Models []AgentAccountModel `json:"models"`
|
|
||||||
APIType string `json:"apiType"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
VerifyModel string `json:"verifyModel"`
|
|
||||||
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 ProviderAPIInfo struct {
|
|
||||||
APIType string `json:"apiType"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
EditableBaseURL bool `json:"editableBaseUrl"`
|
|
||||||
SupportsModelDiscovery bool `json:"supportsModelDiscovery"`
|
|
||||||
DefaultAuthMode string `json:"defaultAuthMode"`
|
|
||||||
AuthModes []string `json:"authModes"`
|
|
||||||
Models []ProviderModelInfo `json:"models"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProviderInfo struct {
|
|
||||||
Sort uint `json:"-"`
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
DisplayName string `json:"displayName"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
DefaultAPIType string `json:"defaultApiType"`
|
|
||||||
APITypes []ProviderAPIInfo `json:"apiTypes"`
|
|
||||||
Models []ProviderModelInfo `json:"models"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentFeishuConfigReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentFeishuConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
ThreadSession bool `json:"threadSession"`
|
|
||||||
ReplyMode string `json:"replyMode" validate:"required"`
|
|
||||||
Streaming bool `json:"streaming"`
|
|
||||||
RequireMention string `json:"requireMention" validate:"required,oneof=true false open"`
|
|
||||||
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Domain string `json:"domain"`
|
|
||||||
ConnectionMode string `json:"connectionMode"`
|
|
||||||
Bots []AgentFeishuBot `json:"bots" validate:"required,min=1"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentFeishuConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
ThreadSession bool `json:"threadSession"`
|
|
||||||
ReplyMode string `json:"replyMode"`
|
|
||||||
Streaming bool `json:"streaming"`
|
|
||||||
RequireMention string `json:"requireMention"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Domain string `json:"domain"`
|
|
||||||
ConnectionMode string `json:"connectionMode"`
|
|
||||||
Bots []AgentFeishuBot `json:"bots"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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,oneof=pairing open allowlist disabled"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
RequireMention bool `json:"requireMention"`
|
|
||||||
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Proxy string `json:"proxy"`
|
|
||||||
Streaming string `json:"streaming" validate:"required,oneof=off partial block progress"`
|
|
||||||
DefaultAccount string `json:"defaultAccount" validate:"required"`
|
|
||||||
Bots []AgentTelegramBot `json:"bots" validate:"required,min=1"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentTelegramConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
RequireMention bool `json:"requireMention"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Proxy string `json:"proxy"`
|
|
||||||
Streaming string `json:"streaming"`
|
|
||||||
DefaultAccount string `json:"defaultAccount"`
|
|
||||||
Bots []AgentTelegramBot `json:"bots"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentChannelPairingApproveReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu telegram discord wecom qqbot dingtalk"`
|
|
||||||
PairingCode string `json:"pairingCode" validate:"required"`
|
|
||||||
AccountID string `json:"accountId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentChannelDeleteReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu telegram discord wecom qqbot dingtalk weixin"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentWecomConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy" validate:"required,oneof=pairing open allowlist disabled"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
BotID string `json:"botId" validate:"required"`
|
|
||||||
Secret string `json:"secret" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentWecomConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
BotID string `json:"botId"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDingTalkConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy" validate:"required,oneof=pairing allowlist open disabled"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
SeparateSessionByConversation bool `json:"separateSessionByConversation"`
|
|
||||||
GroupSessionScope string `json:"groupSessionScope" validate:"required,oneof=group group_sender"`
|
|
||||||
SharedMemoryAcrossConversations bool `json:"sharedMemoryAcrossConversations"`
|
|
||||||
AsyncMode bool `json:"asyncMode"`
|
|
||||||
AckText string `json:"ackText"`
|
|
||||||
Bots []AgentDingTalkBot `json:"bots" validate:"required,min=1"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDingTalkConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
SeparateSessionByConversation bool `json:"separateSessionByConversation"`
|
|
||||||
GroupSessionScope string `json:"groupSessionScope"`
|
|
||||||
SharedMemoryAcrossConversations bool `json:"sharedMemoryAcrossConversations"`
|
|
||||||
AsyncMode bool `json:"asyncMode"`
|
|
||||||
AckText string `json:"ackText"`
|
|
||||||
Bots []AgentDingTalkBot `json:"bots"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentWeixinLoginReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentWeixinConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentQQBotConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Bots []AgentQQBotBot `json:"bots" validate:"required,min=1"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentQQBotConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
GroupAllowFrom []string `json:"groupAllowFrom"`
|
|
||||||
Bots []AgentQQBotBot `json:"bots"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginInstallReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu qqbot wecom dingtalk weixin"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginUpgradeReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu qqbot wecom dingtalk weixin"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginUninstallReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu qqbot wecom dingtalk weixin"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginCheckReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=feishu qqbot wecom dingtalk weixin"`
|
|
||||||
CheckLatest bool `json:"checkLatest"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginStatus struct {
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
CurrentVersion string `json:"currentVersion"`
|
|
||||||
LatestVersion string `json:"latestVersion"`
|
|
||||||
Upgradable bool `json:"upgradable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginsReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginSearchReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Keyword string `json:"keyword" validate:"required,max=100"`
|
|
||||||
Limit int `json:"limit" validate:"omitempty,min=1,max=100"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginMarketInstallReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Package string `json:"package" validate:"required,max=200"`
|
|
||||||
Version string `json:"version" validate:"required,max=100"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginOperateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
PluginID string `json:"pluginId" validate:"required,max=200"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=enable disable update uninstall"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginItem struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Origin string `json:"origin"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentPluginSearchItem struct {
|
|
||||||
Package string `json:"package"`
|
|
||||||
PluginID string `json:"pluginId"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Channel string `json:"channel"`
|
|
||||||
VerificationTier string `json:"verificationTier"`
|
|
||||||
Categories []string `json:"categories"`
|
|
||||||
Official bool `json:"official"`
|
|
||||||
Downloads int64 `json:"downloads"`
|
|
||||||
Score float64 `json:"score"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDiscordConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy" validate:"required"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
RequireMention bool `json:"requireMention"`
|
|
||||||
GroupPolicy string `json:"groupPolicy" validate:"required,oneof=open allowlist disabled"`
|
|
||||||
Proxy string `json:"proxy"`
|
|
||||||
DefaultAccount string `json:"defaultAccount" validate:"required"`
|
|
||||||
Bots []AgentDiscordBot `json:"bots" validate:"required,min=1"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDiscordConfig struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
RequireMention bool `json:"requireMention"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
Proxy string `json:"proxy"`
|
|
||||||
DefaultAccount string `json:"defaultAccount"`
|
|
||||||
Bots []AgentDiscordBot `json:"bots"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentChannelBotBase struct {
|
|
||||||
AccountID string `json:"accountId"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
IsDefault bool `json:"isDefault"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b AgentChannelBotBase) IsEnabled() bool {
|
|
||||||
return b.Enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentFeishuBot struct {
|
|
||||||
AgentChannelBotBase
|
|
||||||
AppID string `json:"appId"`
|
|
||||||
AppSecret string `json:"appSecret"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentTelegramBot struct {
|
|
||||||
AgentChannelBotBase
|
|
||||||
BotToken string `json:"botToken"`
|
|
||||||
DmPolicy string `json:"dmPolicy"`
|
|
||||||
GroupPolicy string `json:"groupPolicy"`
|
|
||||||
Streaming string `json:"streaming"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDiscordBot struct {
|
|
||||||
AgentChannelBotBase
|
|
||||||
Token string `json:"token"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentQQBotBot struct {
|
|
||||||
AgentChannelBotBase
|
|
||||||
AppID string `json:"appId"`
|
|
||||||
ClientSecret string `json:"clientSecret"`
|
|
||||||
AllowFrom []string `json:"allowFrom"`
|
|
||||||
SystemPrompt string `json:"systemPrompt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentDingTalkBot struct {
|
|
||||||
AgentChannelBotBase
|
|
||||||
ClientID string `json:"clientId"`
|
|
||||||
ClientSecret string `json:"clientSecret"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSecurityConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
AllowedOrigins []string `json:"allowedOrigins"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSecurityConfig struct {
|
|
||||||
AllowedOrigins []string `json:"allowedOrigins"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentOtherConfigUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
UserTimezone string `json:"userTimezone"`
|
|
||||||
BrowserEnabled bool `json:"browserEnabled"`
|
|
||||||
NPMRegistry string `json:"npmRegistry"`
|
|
||||||
DashboardUsername string `json:"dashboardUsername"`
|
|
||||||
DashboardPassword string `json:"dashboardPassword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentOtherConfig struct {
|
|
||||||
UserTimezone string `json:"userTimezone"`
|
|
||||||
BrowserEnabled bool `json:"browserEnabled"`
|
|
||||||
NPMRegistry string `json:"npmRegistry"`
|
|
||||||
DashboardUsername string `json:"dashboardUsername"`
|
|
||||||
DashboardPassword string `json:"dashboardPassword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentConfigFileReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentConfigFileUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentConfigFile struct {
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillSearchReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Source string `json:"source" validate:"required,oneof=clawhub-global clawhub-cn skillhub official skills-sh local-hub"`
|
|
||||||
Keyword string `json:"keyword" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillItem struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Category string `json:"category"`
|
|
||||||
Tags []string `json:"tags"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
Trust string `json:"trust"`
|
|
||||||
Identifier string `json:"identifier"`
|
|
||||||
Bundled bool `json:"bundled"`
|
|
||||||
Disabled bool `json:"disabled"`
|
|
||||||
Uninstallable bool `json:"uninstallable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillSearchItem struct {
|
|
||||||
Slug string `json:"slug"`
|
|
||||||
Identifier string `json:"identifier"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Summary string `json:"summary"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
Trust string `json:"trust"`
|
|
||||||
Score string `json:"score"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillUpdateReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillInstallReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Source string `json:"source" validate:"required,oneof=clawhub-global clawhub-cn skillhub official skills-sh local-hub"`
|
|
||||||
Slug string `json:"slug" validate:"required"`
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSkillUninstallReq struct {
|
|
||||||
AgentID uint `json:"agentId" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
}
|
|
||||||
@@ -1,372 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CreateOrUpdateAlert struct {
|
|
||||||
AlertTitle string `json:"alertTitle"`
|
|
||||||
AlertType string `json:"alertType"`
|
|
||||||
AlertMethod string `json:"alertMethod"`
|
|
||||||
AlertCount uint `json:"alertCount"`
|
|
||||||
EntryID uint `json:"entryID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertBase struct {
|
|
||||||
AlertType string `json:"alertType"`
|
|
||||||
EntryID uint `json:"entryID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushAlert struct {
|
|
||||||
Result string `json:"result,omitempty"`
|
|
||||||
TaskName string `json:"taskName"`
|
|
||||||
AlertType string `json:"alertType"`
|
|
||||||
EntryID uint `json:"entryID"`
|
|
||||||
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 AlertConfigQuery struct {
|
|
||||||
ExcludeTypes []string `json:"excludeTypes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertConfigPageReq struct {
|
|
||||||
PageInfo
|
|
||||||
ExcludeTypes []string `json:"excludeTypes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"`
|
|
||||||
TaskName string `json:"taskName,omitempty"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
SendCount uint `json:"sendCount"`
|
|
||||||
AdvancedParams string `json:"advancedParams"`
|
|
||||||
CreateUser string `json:"createUser"`
|
|
||||||
UpdateUser string `json:"updateUser"`
|
|
||||||
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"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"`
|
|
||||||
Task *AlertTaskMetadata `json:"task,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertTaskMetadata struct {
|
|
||||||
AlertID uint `json:"alertId"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Quota string `json:"quota"`
|
|
||||||
QuotaType string `json:"quotaType"`
|
|
||||||
Method string `json:"method"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"`
|
|
||||||
DisplayName string `json:"displayName"`
|
|
||||||
Revision *time.Time `json:"revision"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertConfigTest struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Config string `json:"config"`
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
const AlertCustomWebhookSchemaVersion = 1
|
|
||||||
|
|
||||||
type AlertConfigStatusUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Status string `json:"status" validate:"required,oneof=Enable Disable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookSecretMutation struct {
|
|
||||||
Action string `json:"action,omitempty"`
|
|
||||||
Value string `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookURL struct {
|
|
||||||
AlertCustomWebhookSecretMutation
|
|
||||||
Configured bool `json:"configured"`
|
|
||||||
Masked string `json:"masked,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookBody struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Template string `json:"template,omitempty"`
|
|
||||||
Fields []AlertCustomWebhookFormField `json:"fields,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookFormField struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookHeader struct {
|
|
||||||
UID string `json:"uid"`
|
|
||||||
Key string `json:"key"`
|
|
||||||
Secret bool `json:"secret"`
|
|
||||||
Action string `json:"action,omitempty"`
|
|
||||||
Value string `json:"value,omitempty"`
|
|
||||||
Configured bool `json:"configured,omitempty"`
|
|
||||||
Masked string `json:"masked,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookConfig struct {
|
|
||||||
SchemaVersion int `json:"schemaVersion"`
|
|
||||||
State string `json:"state,omitempty"`
|
|
||||||
DisplayName string `json:"displayName"`
|
|
||||||
Preset string `json:"preset"`
|
|
||||||
Method string `json:"method"`
|
|
||||||
URL AlertCustomWebhookURL `json:"url"`
|
|
||||||
Body AlertCustomWebhookBody `json:"body"`
|
|
||||||
Headers []AlertCustomWebhookHeader `json:"headers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookSecretConfig struct {
|
|
||||||
SchemaVersion int `json:"schemaVersion"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
Headers map[string]string `json:"headers,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookResolvedConfig struct {
|
|
||||||
SchemaVersion int
|
|
||||||
DisplayName string
|
|
||||||
Preset string
|
|
||||||
Method string
|
|
||||||
URL string
|
|
||||||
Body AlertCustomWebhookBody
|
|
||||||
Headers []AlertCustomWebhookResolvedHeader
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertCustomWebhookResolvedHeader struct {
|
|
||||||
Key string
|
|
||||||
Value string
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertConfigTestResult struct {
|
|
||||||
Success bool `json:"success"`
|
|
||||||
StatusCode int `json:"statusCode,omitempty"`
|
|
||||||
Duration int64 `json:"duration,omitempty"` // milliseconds
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
Response string `json:"response,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BackupOperate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
IsPublic bool `json:"isPublic"`
|
|
||||||
Bucket string `json:"bucket"`
|
|
||||||
AccessKey string `json:"accessKey"`
|
|
||||||
Credential string `json:"credential"`
|
|
||||||
BackupPath string `json:"backupPath"`
|
|
||||||
Vars string `json:"vars" validate:"required"`
|
|
||||||
|
|
||||||
RememberAuth bool `json:"rememberAuth"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BackupInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
IsPublic bool `json:"isPublic"`
|
|
||||||
Bucket string `json:"bucket"`
|
|
||||||
AccessKey string `json:"accessKey"`
|
|
||||||
Credential string `json:"credential"`
|
|
||||||
BackupPath string `json:"backupPath"`
|
|
||||||
Vars string `json:"vars"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
|
|
||||||
RememberAuth bool `json:"rememberAuth"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BackupCheckRes struct {
|
|
||||||
IsOk bool `json:"isOk"`
|
|
||||||
Msg string `json:"msg"`
|
|
||||||
Token string `json:"token"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ForBuckets struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
AccessKey string `json:"accessKey"`
|
|
||||||
Credential string `json:"credential" validate:"required"`
|
|
||||||
Vars string `json:"vars" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SyncFromMaster struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=create delete update"`
|
|
||||||
Data string `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BackupOption struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
IsPublic bool `json:"isPublic"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UploadForRecover struct {
|
|
||||||
FilePath string `json:"filePath"`
|
|
||||||
TargetDir string `json:"targetDir"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CommonBackup struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql mongodb mysql-cluster postgresql-cluster redis-cluster container compose"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DetailName string `json:"detailName"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
IsImmediate bool `json:"isImmediate"`
|
|
||||||
StopBefore bool `json:"stopBefore"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
Args []string `json:"args"`
|
|
||||||
|
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
|
||||||
type CommonRecover struct {
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=app mysql mariadb redis website postgresql mongodb mysql-cluster postgresql-cluster redis-cluster container compose"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DetailName string `json:"detailName"`
|
|
||||||
File string `json:"file"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
DropAllCollections bool `json:"dropAllCollections"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
BackupRecordID uint `json:"backupRecordID"`
|
|
||||||
Timeout int `json:"timeout"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RecordSearch struct {
|
|
||||||
PageInfo
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DetailName string `json:"detailName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RecordSearchByCronjob struct {
|
|
||||||
PageInfo
|
|
||||||
CronjobID uint `json:"cronjobID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BackupRecords struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
AccountType string `json:"accountType"`
|
|
||||||
AccountName string `json:"accountName"`
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
|
||||||
FileDir string `json:"fileDir"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DownloadRecord struct {
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID" validate:"required"`
|
|
||||||
FileDir string `json:"fileDir" validate:"required"`
|
|
||||||
FileName string `json:"fileName" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SearchForSize struct {
|
|
||||||
PageInfo
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DetailName string `json:"detailName"`
|
|
||||||
Info string `json:"info"`
|
|
||||||
CronjobID uint `json:"cronjobID"`
|
|
||||||
OrderBy string `json:"orderBy"`
|
|
||||||
Order string `json:"order"`
|
|
||||||
}
|
|
||||||
type RecordFileSize struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
}
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PageContainer struct {
|
|
||||||
PageInfo
|
|
||||||
Name string `json:"name"`
|
|
||||||
State string `json:"state" validate:"required,oneof=all created running paused restarting removing exited dead"`
|
|
||||||
OrderBy string `json:"orderBy" validate:"required,oneof=name createdAt state"`
|
|
||||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
|
||||||
Filters string `json:"filters"`
|
|
||||||
ExcludeAppStore bool `json:"excludeAppStore"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InspectReq struct {
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Detail string `json:"detail"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerInfo struct {
|
|
||||||
ContainerID string `json:"containerID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
ImageId string `json:"imageID"`
|
|
||||||
ImageName string `json:"imageName"`
|
|
||||||
CreateTime string `json:"createTime"`
|
|
||||||
State string `json:"state"`
|
|
||||||
RunTime string `json:"runTime"`
|
|
||||||
|
|
||||||
Network []string `json:"network"`
|
|
||||||
Ports []string `json:"ports"`
|
|
||||||
|
|
||||||
IsFromApp bool `json:"isFromApp"`
|
|
||||||
IsFromCompose bool `json:"isFromCompose"`
|
|
||||||
|
|
||||||
AppName string `json:"appName"`
|
|
||||||
AppInstallName string `json:"appInstallName"`
|
|
||||||
Websites []string `json:"websites"`
|
|
||||||
|
|
||||||
IsPinned bool `json:"isPinned"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerOptions struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
State string `json:"state"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerFileReq struct {
|
|
||||||
ContainerID string `json:"containerID" validate:"required"`
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerFileBatchDeleteReq struct {
|
|
||||||
ContainerID string `json:"containerID" validate:"required"`
|
|
||||||
Paths []string `json:"paths" validate:"required,min=1,dive,required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerFileInfo struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
IsLink bool `json:"isLink"`
|
|
||||||
LinkTo string `json:"linkTo"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
ModTime string `json:"modTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerFileContent struct {
|
|
||||||
Content string `json:"content"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
Truncated bool `json:"truncated"`
|
|
||||||
IsBinary bool `json:"isBinary"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerStatus struct {
|
|
||||||
Created int `json:"created"`
|
|
||||||
Running int `json:"running"`
|
|
||||||
Paused int `json:"paused"`
|
|
||||||
Restarting int `json:"restarting"`
|
|
||||||
Removing int `json:"removing"`
|
|
||||||
Exited int `json:"exited"`
|
|
||||||
Dead int `json:"dead"`
|
|
||||||
|
|
||||||
ContainerCount int `json:"containerCount"`
|
|
||||||
ComposeCount int `json:"composeCount"`
|
|
||||||
ComposeTemplateCount int `json:"composeTemplateCount"`
|
|
||||||
ImageCount int `json:"imageCount"`
|
|
||||||
NetworkCount int `json:"networkCount"`
|
|
||||||
VolumeCount int `json:"volumeCount"`
|
|
||||||
RepoCount int `json:"repoCount"`
|
|
||||||
}
|
|
||||||
type ResourceLimit struct {
|
|
||||||
CPU int `json:"cpu"`
|
|
||||||
Memory uint64 `json:"memory"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerOperate struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
ForcePull bool `json:"forcePull"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Image string `json:"image" validate:"required"`
|
|
||||||
|
|
||||||
Hostname string `json:"hostname"`
|
|
||||||
DomainName string `json:"domainName"`
|
|
||||||
DNS []string `json:"dns"`
|
|
||||||
Networks []ContainerNetwork `json:"networks"`
|
|
||||||
|
|
||||||
PublishAllPorts bool `json:"publishAllPorts"`
|
|
||||||
ExposedPorts []PortHelper `json:"exposedPorts"`
|
|
||||||
Tty bool `json:"tty"`
|
|
||||||
OpenStdin bool `json:"openStdin"`
|
|
||||||
WorkingDir string `json:"workingDir"`
|
|
||||||
User string `json:"user"`
|
|
||||||
Cmd []string `json:"cmd"`
|
|
||||||
Entrypoint []string `json:"entrypoint"`
|
|
||||||
CPUShares int64 `json:"cpuShares"`
|
|
||||||
NanoCPUs float64 `json:"nanoCPUs"`
|
|
||||||
Memory float64 `json:"memory"`
|
|
||||||
Privileged bool `json:"privileged"`
|
|
||||||
AutoRemove bool `json:"autoRemove"`
|
|
||||||
Volumes []VolumeHelper `json:"volumes"`
|
|
||||||
ExtraHosts []ExtraHost `json:"extraHosts"`
|
|
||||||
Labels []string `json:"labels"`
|
|
||||||
Env []string `json:"env"`
|
|
||||||
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"`
|
|
||||||
Links []string `json:"links"`
|
|
||||||
Aliases []string `json:"aliases"`
|
|
||||||
DriverOpts map[string]string `json:"driverOpts"`
|
|
||||||
GwPriority int `json:"gwPriority"`
|
|
||||||
LinkLocalIPs []string `json:"linkLocalIPs"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerCreateByCommand struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Command string `json:"command"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerUpgrade struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Names []string `json:"names" validate:"required"`
|
|
||||||
Image string `json:"image" validate:"required"`
|
|
||||||
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 {
|
|
||||||
ContainerID string `json:"containerID"`
|
|
||||||
|
|
||||||
CPUTotalUsage uint64 `json:"cpuTotalUsage"`
|
|
||||||
SystemUsage uint64 `json:"systemUsage"`
|
|
||||||
CPUPercent float64 `json:"cpuPercent"`
|
|
||||||
PercpuUsage int `json:"percpuUsage"`
|
|
||||||
|
|
||||||
MemoryCache uint64 `json:"memoryCache"`
|
|
||||||
MemoryUsage uint64 `json:"memoryUsage"`
|
|
||||||
MemoryLimit uint64 `json:"memoryLimit"`
|
|
||||||
MemoryPercent float64 `json:"memoryPercent"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerStats struct {
|
|
||||||
CPUPercent float64 `json:"cpuPercent"`
|
|
||||||
Memory float64 `json:"memory"`
|
|
||||||
Cache float64 `json:"cache"`
|
|
||||||
IORead float64 `json:"ioRead"`
|
|
||||||
IOWrite float64 `json:"ioWrite"`
|
|
||||||
NetworkRX float64 `json:"networkRX"`
|
|
||||||
NetworkTX float64 `json:"networkTX"`
|
|
||||||
|
|
||||||
ShotTime time.Time `json:"shotTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type VolumeHelper struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
SourceDir string `json:"sourceDir"`
|
|
||||||
ContainerDir string `json:"containerDir"`
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
Shared string `json:"shared"`
|
|
||||||
}
|
|
||||||
type PortHelper struct {
|
|
||||||
HostIP string `json:"hostIP"`
|
|
||||||
HostPort string `json:"hostPort"`
|
|
||||||
ContainerPort string `json:"containerPort"`
|
|
||||||
Protocol string `json:"protocol"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerOperation struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Names []string `json:"names" validate:"required"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=up start stop restart kill pause unpause remove"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerRename struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
NewName string `json:"newName" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerCommit struct {
|
|
||||||
ContainerId string `json:"containerID" validate:"required"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
NewImageName string `json:"newImageName"`
|
|
||||||
Comment string `json:"comment"`
|
|
||||||
Author string `json:"author"`
|
|
||||||
Pause bool `json:"pause"`
|
|
||||||
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerPrune struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
PruneType string `json:"pruneType" validate:"required,oneof=container image volume network buildcache"`
|
|
||||||
WithTagAll bool `json:"withTagAll"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Network struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Labels []string `json:"labels"`
|
|
||||||
Driver string `json:"driver"`
|
|
||||||
IPAMDriver string `json:"ipamDriver"`
|
|
||||||
Subnet string `json:"subnet"`
|
|
||||||
Gateway string `json:"gateway"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
Attachable bool `json:"attachable"`
|
|
||||||
}
|
|
||||||
type NetworkCreate struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Driver string `json:"driver" validate:"required"`
|
|
||||||
Options []string `json:"options"`
|
|
||||||
Ipv4 bool `json:"ipv4"`
|
|
||||||
Subnet string `json:"subnet"`
|
|
||||||
Gateway string `json:"gateway"`
|
|
||||||
IPRange string `json:"ipRange"`
|
|
||||||
AuxAddress []SettingUpdate `json:"auxAddress"`
|
|
||||||
|
|
||||||
Ipv6 bool `json:"ipv6"`
|
|
||||||
SubnetV6 string `json:"subnetV6"`
|
|
||||||
GatewayV6 string `json:"gatewayV6"`
|
|
||||||
IPRangeV6 string `json:"ipRangeV6"`
|
|
||||||
AuxAddressV6 []SettingUpdate `json:"auxAddressV6"`
|
|
||||||
Labels []string `json:"labels"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Volume struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Labels []VolumeOption `json:"labels"`
|
|
||||||
Driver string `json:"driver"`
|
|
||||||
Mountpoint string `json:"mountpoint"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
Options []VolumeOption `json:"options"`
|
|
||||||
}
|
|
||||||
type VolumeCreate struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Driver string `json:"driver" validate:"required"`
|
|
||||||
Options []string `json:"options"`
|
|
||||||
Labels []string `json:"labels"`
|
|
||||||
}
|
|
||||||
type VolumeOption struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
type BatchDelete struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Force bool `json:"force"`
|
|
||||||
Names []string `json:"names" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ComposeInfo struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
CreatedAt string `json:"createdAt"`
|
|
||||||
CreatedBy string `json:"createdBy"`
|
|
||||||
ContainerCount int `json:"containerCount"`
|
|
||||||
RunningCount int `json:"runningCount"`
|
|
||||||
ConfigFile string `json:"configFile"`
|
|
||||||
Workdir string `json:"workdir"`
|
|
||||||
ComposeFileExists bool `json:"composeFileExists"`
|
|
||||||
IsPinned bool `json:"isPinned"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Containers []ComposeContainer `json:"containers"`
|
|
||||||
Env string `json:"env"`
|
|
||||||
}
|
|
||||||
type ComposeContainer struct {
|
|
||||||
ContainerID string `json:"containerID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
CreateTime string `json:"createTime"`
|
|
||||||
State string `json:"state"`
|
|
||||||
Ports []string `json:"ports"`
|
|
||||||
}
|
|
||||||
type ComposeCreate struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
DirName string `json:"dirName"`
|
|
||||||
From string `json:"from" validate:"required,oneof=edit path template"`
|
|
||||||
File string `json:"file"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Template uint `json:"template"`
|
|
||||||
Env string `json:"env"`
|
|
||||||
ForcePull bool `json:"forcePull"`
|
|
||||||
}
|
|
||||||
type ComposeOperation struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=up start restart stop down delete rebuild"`
|
|
||||||
WithFile bool `json:"withFile"`
|
|
||||||
Force bool `json:"force"`
|
|
||||||
}
|
|
||||||
type ComposeUpdate struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
DetailPath string `json:"detailPath"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
Env string `json:"env"`
|
|
||||||
ForcePull bool `json:"forcePull"`
|
|
||||||
}
|
|
||||||
type ComposePin struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
IsPinned bool `json:"isPinned"`
|
|
||||||
}
|
|
||||||
type ComposeLogClean struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
DetailPath string `json:"detailPath"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ContainerLog struct {
|
|
||||||
Container string `json:"container" validate:"required"`
|
|
||||||
Since string `json:"since"`
|
|
||||||
Tail uint `json:"tail"`
|
|
||||||
Timestamp bool `json:"timestamp"`
|
|
||||||
ContainerType string `json:"containerType"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type StreamLog struct {
|
|
||||||
Compose string
|
|
||||||
Container string
|
|
||||||
Since string
|
|
||||||
Follow bool
|
|
||||||
Tail string
|
|
||||||
Timestamp bool
|
|
||||||
Type string
|
|
||||||
}
|
|
||||||
@@ -1,212 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PageCronjob struct {
|
|
||||||
PageInfo
|
|
||||||
Info string `json:"info"`
|
|
||||||
GroupIDs []uint `json:"groupIDs"`
|
|
||||||
OrderBy string `json:"orderBy" validate:"required,oneof=name status createdAt"`
|
|
||||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobSpec struct {
|
|
||||||
Spec string `json:"spec" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobOperate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
GroupID uint `json:"groupID"`
|
|
||||||
SpecCustom bool `json:"specCustom"`
|
|
||||||
Spec string `json:"spec" validate:"required"`
|
|
||||||
|
|
||||||
Executor string `json:"executor"`
|
|
||||||
ScriptMode string `json:"scriptMode"`
|
|
||||||
Script string `json:"script"`
|
|
||||||
Command string `json:"command"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
User string `json:"user"`
|
|
||||||
|
|
||||||
ScriptID uint `json:"scriptID"`
|
|
||||||
AppID string `json:"appID"`
|
|
||||||
Website string `json:"website"`
|
|
||||||
ExclusionRules string `json:"exclusionRules"`
|
|
||||||
DBType string `json:"dbType"`
|
|
||||||
DBName string `json:"dbName"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
SourceDir string `json:"sourceDir"`
|
|
||||||
SnapshotRule SnapshotRule `json:"snapshotRule"`
|
|
||||||
|
|
||||||
SourceAccountIDs string `json:"sourceAccountIDs"`
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
|
||||||
RetainCopies int `json:"retainCopies" validate:"number,min=1"`
|
|
||||||
RetryTimes int `json:"retryTimes" validate:"number,min=0"`
|
|
||||||
Timeout uint `json:"timeout" validate:"number,min=1"`
|
|
||||||
IgnoreErr bool `json:"ignoreErr"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
Args string `json:"args"`
|
|
||||||
|
|
||||||
AlertCount uint `json:"alertCount"`
|
|
||||||
AlertTitle string `json:"alertTitle"`
|
|
||||||
AlertMethod string `json:"alertMethod"`
|
|
||||||
AlertTriggerMode string `json:"alertTriggerMode" validate:"omitempty,oneof=failed success both"`
|
|
||||||
|
|
||||||
CleanLogConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type CleanLogConfig struct {
|
|
||||||
Scopes []string `json:"scopes"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotRule struct {
|
|
||||||
WithImage bool `json:"withImage"`
|
|
||||||
IgnoreAppIDs []uint `json:"ignoreAppIDs"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobUpdateStatus struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Status string `json:"status" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobClean struct {
|
|
||||||
IsDelete bool `json:"isDelete"`
|
|
||||||
CleanData bool `json:"cleanData"`
|
|
||||||
CronjobID uint `json:"cronjobID" validate:"required"`
|
|
||||||
CleanRemoteData bool `json:"cleanRemoteData"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobBatchDelete struct {
|
|
||||||
CleanData bool `json:"cleanData"`
|
|
||||||
CleanRemoteData bool `json:"cleanRemoteData"`
|
|
||||||
IDs []uint `json:"ids" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CronjobInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
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"`
|
|
||||||
|
|
||||||
ScriptID uint `json:"scriptID"`
|
|
||||||
AppID string `json:"appID"`
|
|
||||||
Website string `json:"website"`
|
|
||||||
ExclusionRules string `json:"exclusionRules"`
|
|
||||||
DBType string `json:"dbType"`
|
|
||||||
DBName string `json:"dbName"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
SourceDir string `json:"sourceDir"`
|
|
||||||
RetainCopies int `json:"retainCopies"`
|
|
||||||
RetryTimes int `json:"retryTimes"`
|
|
||||||
Timeout uint `json:"timeout"`
|
|
||||||
IgnoreErr bool `json:"ignoreErr"`
|
|
||||||
SnapshotRule SnapshotRule `json:"snapshotRule"`
|
|
||||||
|
|
||||||
SourceAccounts []string `json:"sourceAccounts"`
|
|
||||||
DownloadAccount string `json:"downloadAccount"`
|
|
||||||
SourceAccountIDs string `json:"sourceAccountIDs"`
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
|
||||||
|
|
||||||
LastRecordStatus string `json:"lastRecordStatus"`
|
|
||||||
LastRecordTime string `json:"lastRecordTime"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
Args string `json:"args"`
|
|
||||||
|
|
||||||
AlertCount uint `json:"alertCount"`
|
|
||||||
AlertTriggerMode string `json:"alertTriggerMode"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"`
|
|
||||||
AlertTriggerMode string `json:"alertTriggerMode" validate:"omitempty,oneof=failed success both"`
|
|
||||||
}
|
|
||||||
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 {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SearchRecord struct {
|
|
||||||
PageInfo
|
|
||||||
CronjobID int `json:"cronjobID"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Record struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
CronjobID uint `json:"cronjobID"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
StartTime string `json:"startTime"`
|
|
||||||
Records string `json:"records"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
TargetPath string `json:"targetPath"`
|
|
||||||
Interval int `json:"interval"`
|
|
||||||
File string `json:"file"`
|
|
||||||
}
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type DashboardBase struct {
|
|
||||||
WebsiteNumber int `json:"websiteNumber"`
|
|
||||||
AgentNumber int `json:"agentNumber"`
|
|
||||||
DatabaseNumber int `json:"databaseNumber"`
|
|
||||||
CronjobNumber int `json:"cronjobNumber"`
|
|
||||||
AppInstalledNumber int `json:"appInstalledNumber"`
|
|
||||||
|
|
||||||
Hostname string `json:"hostname"`
|
|
||||||
OS string `json:"os"`
|
|
||||||
Platform string `json:"platform"`
|
|
||||||
PlatformFamily string `json:"platformFamily"`
|
|
||||||
PlatformVersion string `json:"platformVersion"`
|
|
||||||
PrettyDistro string `json:"prettyDistro"`
|
|
||||||
KernelArch string `json:"kernelArch"`
|
|
||||||
KernelVersion string `json:"kernelVersion"`
|
|
||||||
VirtualizationSystem string `json:"virtualizationSystem"`
|
|
||||||
IpV4Addr string `json:"ipV4Addr"`
|
|
||||||
SystemProxy string `json:"systemProxy"`
|
|
||||||
|
|
||||||
CPUCores int `json:"cpuCores"`
|
|
||||||
CPULogicalCores int `json:"cpuLogicalCores"`
|
|
||||||
CPUModelName string `json:"cpuModelName"`
|
|
||||||
CPUMhz float64 `json:"cpuMhz"`
|
|
||||||
|
|
||||||
QuickJumps []QuickJump `json:"quickJump"`
|
|
||||||
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 {
|
|
||||||
OS string `json:"os"`
|
|
||||||
Platform string `json:"platform"`
|
|
||||||
PlatformFamily string `json:"platformFamily"`
|
|
||||||
KernelArch string `json:"kernelArch"`
|
|
||||||
KernelVersion string `json:"kernelVersion"`
|
|
||||||
PrettyDistro string `json:"prettyDistro"`
|
|
||||||
|
|
||||||
DiskSize int64 `json:"diskSize"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodeCurrent struct {
|
|
||||||
Load1 float64 `json:"load1"`
|
|
||||||
Load5 float64 `json:"load5"`
|
|
||||||
Load15 float64 `json:"load15"`
|
|
||||||
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
|
||||||
|
|
||||||
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
|
||||||
CPUUsed float64 `json:"cpuUsed"`
|
|
||||||
CPUTotal int `json:"cpuTotal"`
|
|
||||||
CPUDetailedPercent []float64 `json:"cpuDetailedPercent"`
|
|
||||||
|
|
||||||
MemoryTotal uint64 `json:"memoryTotal"`
|
|
||||||
MemoryAvailable uint64 `json:"memoryAvailable"`
|
|
||||||
MemoryUsed uint64 `json:"memoryUsed"`
|
|
||||||
MemoryUsedPercent float64 `json:"memoryUsedPercent"`
|
|
||||||
|
|
||||||
SwapMemoryTotal uint64 `json:"swapMemoryTotal"`
|
|
||||||
SwapMemoryAvailable uint64 `json:"swapMemoryAvailable"`
|
|
||||||
SwapMemoryUsed uint64 `json:"swapMemoryUsed"`
|
|
||||||
SwapMemoryUsedPercent float64 `json:"swapMemoryUsedPercent"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DashboardCurrent struct {
|
|
||||||
Uptime uint64 `json:"uptime"`
|
|
||||||
TimeSinceUptime string `json:"timeSinceUptime"`
|
|
||||||
RunningTime RunningTime `json:"runningTime"`
|
|
||||||
|
|
||||||
Procs uint64 `json:"procs"`
|
|
||||||
|
|
||||||
Load1 float64 `json:"load1"`
|
|
||||||
Load5 float64 `json:"load5"`
|
|
||||||
Load15 float64 `json:"load15"`
|
|
||||||
LoadUsagePercent float64 `json:"loadUsagePercent"`
|
|
||||||
|
|
||||||
CPUPercent []float64 `json:"cpuPercent"`
|
|
||||||
CPUUsedPercent float64 `json:"cpuUsedPercent"`
|
|
||||||
CPUUsed float64 `json:"cpuUsed"`
|
|
||||||
CPUTotal int `json:"cpuTotal"`
|
|
||||||
CPUDetailedPercent []float64 `json:"cpuDetailedPercent"`
|
|
||||||
|
|
||||||
MemoryTotal uint64 `json:"memoryTotal"`
|
|
||||||
MemoryUsed uint64 `json:"memoryUsed"`
|
|
||||||
MemoryFree uint64 `json:"memoryFree"`
|
|
||||||
MemoryShard uint64 `json:"memoryShard"`
|
|
||||||
MemoryCache uint64 `json:"memoryCache"`
|
|
||||||
MemoryAvailable uint64 `json:"memoryAvailable"`
|
|
||||||
MemoryUsedPercent float64 `json:"memoryUsedPercent"`
|
|
||||||
|
|
||||||
SwapMemoryTotal uint64 `json:"swapMemoryTotal"`
|
|
||||||
SwapMemoryAvailable uint64 `json:"swapMemoryAvailable"`
|
|
||||||
SwapMemoryUsed uint64 `json:"swapMemoryUsed"`
|
|
||||||
SwapMemoryUsedPercent float64 `json:"swapMemoryUsedPercent"`
|
|
||||||
|
|
||||||
IOReadBytes uint64 `json:"ioReadBytes"`
|
|
||||||
IOWriteBytes uint64 `json:"ioWriteBytes"`
|
|
||||||
IOCount uint64 `json:"ioCount"`
|
|
||||||
IOReadTime uint64 `json:"ioReadTime"`
|
|
||||||
IOWriteTime uint64 `json:"ioWriteTime"`
|
|
||||||
|
|
||||||
DiskData []DiskInfo `json:"diskData"`
|
|
||||||
|
|
||||||
NetBytesSent uint64 `json:"netBytesSent"`
|
|
||||||
NetBytesRecv uint64 `json:"netBytesRecv"`
|
|
||||||
|
|
||||||
GPUData []GPUInfo `json:"gpuData"`
|
|
||||||
NPUData []NPUInfo `json:"npuData"`
|
|
||||||
XPUData []XPUInfo `json:"xpuData"`
|
|
||||||
|
|
||||||
TopCPUItems []Process `json:"topCPUItems"`
|
|
||||||
TopMemItems []Process `json:"topMemItems"`
|
|
||||||
|
|
||||||
ShotTime time.Time `json:"shotTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RunningTime struct {
|
|
||||||
Days uint64 `json:"days"`
|
|
||||||
Hours uint64 `json:"hours"`
|
|
||||||
Minutes uint64 `json:"minutes"`
|
|
||||||
Seconds uint64 `json:"seconds"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppLauncherSync struct {
|
|
||||||
Keys []string `json:"keys"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DiskInfo 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 GPUInfo struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Index uint `json:"index"`
|
|
||||||
NPUIndex uint `json:"npuIndex"`
|
|
||||||
ChipIndex uint `json:"chipIndex"`
|
|
||||||
ProductName string `json:"productName"`
|
|
||||||
BusID string `json:"busID"`
|
|
||||||
GPUUtil string `json:"gpuUtil"`
|
|
||||||
Temperature string `json:"temperature"`
|
|
||||||
PerformanceState string `json:"performanceState"`
|
|
||||||
PowerUsage string `json:"powerUsage"`
|
|
||||||
PowerDraw string `json:"powerDraw"`
|
|
||||||
MaxPowerLimit string `json:"maxPowerLimit"`
|
|
||||||
MemoryUsage string `json:"memoryUsage"`
|
|
||||||
MemUsed string `json:"memUsed"`
|
|
||||||
MemTotal string `json:"memTotal"`
|
|
||||||
FanSpeed string `json:"fanSpeed"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NPUInfo struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
Index uint `json:"index"`
|
|
||||||
NPUIndex uint `json:"npuIndex"`
|
|
||||||
ChipIndex uint `json:"chipIndex"`
|
|
||||||
ProductName string `json:"productName"`
|
|
||||||
BusID string `json:"busID"`
|
|
||||||
Health string `json:"health"`
|
|
||||||
Temperature string `json:"temperature"`
|
|
||||||
PowerDraw string `json:"powerDraw"`
|
|
||||||
AICore string `json:"aiCore"`
|
|
||||||
MemUsed string `json:"memUsed"`
|
|
||||||
MemTotal string `json:"memTotal"`
|
|
||||||
MemoryUsed string `json:"memoryUsed"`
|
|
||||||
MemoryTotal string `json:"memoryTotal"`
|
|
||||||
HBMUsed string `json:"hbmUsed"`
|
|
||||||
HBMTotal string `json:"hbmTotal"`
|
|
||||||
HugepagesUsed string `json:"hugepagesUsed"`
|
|
||||||
HugepagesTotal string `json:"hugepagesTotal"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppLauncher struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Icon string `json:"icon"`
|
|
||||||
Limit int `json:"limit"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Recommend int `json:"recommend"`
|
|
||||||
|
|
||||||
IsInstall bool `json:"isInstall"`
|
|
||||||
IsRecommend bool `json:"isRecommend"`
|
|
||||||
Detail []InstallDetail `json:"detail"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type InstallDetail struct {
|
|
||||||
InstallID uint `json:"installID"`
|
|
||||||
DetailID uint `json:"detailID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
WebUI string `json:"webUI"`
|
|
||||||
HttpPort int `json:"httpPort"`
|
|
||||||
HttpsPort int `json:"httpsPort"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type LauncherOption struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
IsShow bool `json:"isShow"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type XPUInfo struct {
|
|
||||||
DeviceID int `json:"deviceID"`
|
|
||||||
DeviceName string `json:"deviceName"`
|
|
||||||
PciBdfAddress string `json:"pciBdfAddress"`
|
|
||||||
Memory string `json:"memory"`
|
|
||||||
Temperature string `json:"temperature"`
|
|
||||||
GPUUtil string `json:"gpuUtil"`
|
|
||||||
MemoryUsed string `json:"memoryUsed"`
|
|
||||||
Power string `json:"power"`
|
|
||||||
MemoryUtil string `json:"memoryUtil"`
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
type LogFileRes struct {
|
|
||||||
Lines []string `json:"lines"`
|
|
||||||
IsEndOfFile bool `json:"isEndOfFile"`
|
|
||||||
TotalPages int `json:"totalPages"`
|
|
||||||
TotalLines int `json:"totalLines"`
|
|
||||||
}
|
|
||||||
@@ -1,353 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/firewall"
|
|
||||||
dockerfirewall "github.com/1Panel-dev/1Panel/agent/utils/firewall/docker_guard"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/firewall/filter"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/firewall/forwarding"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FirewallSubsystemStatus struct {
|
|
||||||
IPv6Enabled bool `json:"ipv6Enabled"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Backend string `json:"backend"`
|
|
||||||
ConflictBackend string `json:"conflictBackend,omitempty"`
|
|
||||||
IsExist bool `json:"isExist"`
|
|
||||||
IsActive bool `json:"isActive"`
|
|
||||||
IsInit bool `json:"isInit"`
|
|
||||||
IsBind bool `json:"isBind"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
PingStatus string `json:"pingStatus"`
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
Reason string `json:"reason,omitempty"`
|
|
||||||
LifecycleTaskID string `json:"lifecycleTaskID,omitempty"`
|
|
||||||
IPv4 FirewallBackendFamilyStatus `json:"ipv4"`
|
|
||||||
IPv6 FirewallBackendFamilyStatus `json:"ipv6"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallLifecycleOperation struct {
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=start stop restart disableBanPing enableBanPing"`
|
|
||||||
WithDockerRestart bool `json:"withDockerRestart"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallLifecycleOperationResponse struct {
|
|
||||||
TaskID string `json:"taskID,omitempty"`
|
|
||||||
Queued bool `json:"queued"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallBackendOption struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
Active bool `json:"active"`
|
|
||||||
Initialized bool `json:"initialized"`
|
|
||||||
Bound bool `json:"bound"`
|
|
||||||
Supported bool `json:"supported"`
|
|
||||||
SupportReason string `json:"supportReason,omitempty"`
|
|
||||||
Implementation string `json:"implementation,omitempty"`
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
IPv4 FirewallBackendFamilyStatus `json:"ipv4"`
|
|
||||||
IPv6 FirewallBackendFamilyStatus `json:"ipv6"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallBackendFamilyStatus struct {
|
|
||||||
Partial bool `json:"partial"`
|
|
||||||
Available bool `json:"available"`
|
|
||||||
Initialized bool `json:"initialized"`
|
|
||||||
Bound bool `json:"bound"`
|
|
||||||
Reason string `json:"reason,omitempty"`
|
|
||||||
RAInterfaces []string `json:"raInterfaces,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallBackendGroup struct {
|
|
||||||
Selected string `json:"selected"`
|
|
||||||
Current string `json:"current,omitempty"`
|
|
||||||
Options []FirewallBackendOption `json:"options"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallSettings struct {
|
|
||||||
IPv6Enabled bool `json:"ipv6Enabled"`
|
|
||||||
System FirewallBackendGroup `json:"system"`
|
|
||||||
Forwarding FirewallBackendGroup `json:"forwarding"`
|
|
||||||
Docker FirewallBackendGroup `json:"docker"`
|
|
||||||
PingStatus string `json:"pingStatus"`
|
|
||||||
PortWhitelist []filter.PortWhitelist `json:"portWhiteList"`
|
|
||||||
PanelPort string `json:"panelPort"`
|
|
||||||
SSHPort string `json:"sshPort"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallPortWhitelistCreate struct {
|
|
||||||
Rule filter.PortWhitelist `json:"rule" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallPortWhitelistUpdate struct {
|
|
||||||
OldRule filter.PortWhitelist `json:"oldRule" validate:"required"`
|
|
||||||
Rule filter.PortWhitelist `json:"rule" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallPortWhitelistDelete struct {
|
|
||||||
Rule *filter.PortWhitelist `json:"rule" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallBackendOperation struct {
|
|
||||||
Subsystem string `json:"subsystem" validate:"required,oneof=system forwarding docker"`
|
|
||||||
Backend string `json:"backend" validate:"required,oneof=firewalld ufw iptables nftables"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=select initialize cleanup"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallIPv6Operation struct {
|
|
||||||
Status string `json:"status" validate:"required,oneof=Enable Disable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallFamilyOperation struct {
|
|
||||||
Subsystem string `json:"subsystem" validate:"required,oneof=system forwarding docker"`
|
|
||||||
Backend string `json:"backend" validate:"required,oneof=iptables nftables"`
|
|
||||||
Family string `json:"family" validate:"required,oneof=ipv4 ipv6"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=initialize repair bind"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FilterChainOperation struct {
|
|
||||||
Name string `json:"name" validate:"required,eq=1PANEL_BASIC"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=init-base bind-base unbind-base"`
|
|
||||||
TaskID string `json:"taskID,omitempty" validate:"omitempty,max=64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FilterChainOperationResponse struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Queued bool `json:"queued"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallInitializationTask struct {
|
|
||||||
BackupFile string `json:"backupFile,omitempty" validate:"omitempty,max=255"`
|
|
||||||
TaskID string `json:"taskID,omitempty" validate:"omitempty,max=64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallSystemPort = firewall.SystemPort
|
|
||||||
|
|
||||||
type FirewallRuleInventoryResponse struct {
|
|
||||||
IPv4Range filter.PositionRange `json:"ipv4Range"`
|
|
||||||
IPv6Range filter.PositionRange `json:"ipv6Range"`
|
|
||||||
Total int64 `json:"total"`
|
|
||||||
AllTotal int64 `json:"allTotal"`
|
|
||||||
Items []filter.InventoryItem `json:"items"`
|
|
||||||
Notices []filter.ScopeNotice `json:"notices,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleBackup struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Provider filter.Provider `json:"provider"`
|
|
||||||
RuleCount int `json:"ruleCount"`
|
|
||||||
ModifiedAt int64 `json:"modifiedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleBackups struct {
|
|
||||||
Directory string `json:"directory"`
|
|
||||||
Files []FirewallRuleBackup `json:"files"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleResetResponse struct {
|
|
||||||
BackupPath string `json:"backupPath"`
|
|
||||||
Removed int `json:"removed"`
|
|
||||||
Disabled bool `json:"disabled"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleReset struct {
|
|
||||||
Subsystem string `json:"subsystem,omitempty" validate:"omitempty,oneof=system forwarding docker"`
|
|
||||||
Backup *bool `json:"backup,omitempty" default:"true"`
|
|
||||||
Provider filter.Provider `json:"provider,omitempty" validate:"omitempty,oneof=firewalld ufw iptables nftables"`
|
|
||||||
WithDockerRestart bool `json:"withDockerRestart"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleInventory struct {
|
|
||||||
PageInfo
|
|
||||||
Scope filter.Scope `json:"scope,omitempty"`
|
|
||||||
Scopes []filter.Scope `json:"scopes,omitempty" validate:"max=16"`
|
|
||||||
All bool `json:"all,omitempty"`
|
|
||||||
Info string `json:"info"`
|
|
||||||
Families []filter.Family `json:"families,omitempty" validate:"omitempty,dive,oneof=ipv4 ipv6"`
|
|
||||||
Actions []string `json:"actions,omitempty" validate:"omitempty,dive,oneof=accept deny"`
|
|
||||||
ExcludeChains []string `json:"excludeChains,omitempty" validate:"omitempty,dive,oneof=1PANEL_BASIC_BEFORE 1PANEL_BASIC 1PANEL_BASIC_AFTER"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallNativeDetail struct {
|
|
||||||
Provider filter.Provider `json:"provider" validate:"required,oneof=firewalld ufw"`
|
|
||||||
NativeKind filter.NativeKind `json:"nativeKind" validate:"required,oneof=zone_service ufw_application"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Permanent bool `json:"permanent"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardBase struct {
|
|
||||||
IPv6Enabled bool `json:"ipv6Enabled"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
IsExist bool `json:"isExist"`
|
|
||||||
Initialized bool `json:"initialized"`
|
|
||||||
Bound bool `json:"bound"`
|
|
||||||
IPv4 DockerPortGuardFamilyStatus `json:"ipv4"`
|
|
||||||
IPv6 DockerPortGuardFamilyStatus `json:"ipv6"`
|
|
||||||
Backend string `json:"backend"`
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardFamilyStatus struct {
|
|
||||||
Partial bool `json:"partial"`
|
|
||||||
State string `json:"state"`
|
|
||||||
Reason string `json:"reason,omitempty"`
|
|
||||||
Initialized bool `json:"initialized"`
|
|
||||||
Bound bool `json:"bound"`
|
|
||||||
Effective bool `json:"effective"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardEndpoint struct {
|
|
||||||
Family string `json:"family"`
|
|
||||||
HostIP string `json:"hostIP"`
|
|
||||||
HostPort uint16 `json:"hostPort"`
|
|
||||||
Protocol string `json:"protocol"`
|
|
||||||
ContainerID string `json:"containerID"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
ContainerState string `json:"containerState,omitempty"`
|
|
||||||
ContainerPort uint16 `json:"containerPort"`
|
|
||||||
Compose string `json:"compose,omitempty"`
|
|
||||||
Application string `json:"application,omitempty"`
|
|
||||||
PolicyUUID string `json:"policyUUID,omitempty"`
|
|
||||||
Mode string `json:"mode,omitempty"`
|
|
||||||
Sources []string `json:"sources"`
|
|
||||||
Effective bool `json:"effective"`
|
|
||||||
TrafficPath string `json:"trafficPath"`
|
|
||||||
ManagementTarget string `json:"managementTarget"`
|
|
||||||
ManagementReason string `json:"managementReason,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardPortGroup struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
Endpoint DockerPortGuardEndpoint `json:"endpoint"`
|
|
||||||
Endpoints []DockerPortGuardEndpoint `json:"endpoints"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardContainer struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Compose string `json:"compose,omitempty"`
|
|
||||||
Application string `json:"application,omitempty"`
|
|
||||||
Endpoints []DockerPortGuardEndpoint `json:"endpoints"`
|
|
||||||
PortGroups []DockerPortGuardPortGroup `json:"portGroups"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardList struct {
|
|
||||||
Base DockerPortGuardBase `json:"base"`
|
|
||||||
Containers []DockerPortGuardContainer `json:"containers"`
|
|
||||||
OrphanPolicies []DockerPortGuardEndpoint `json:"orphanPolicies"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardEndpointIdentity struct {
|
|
||||||
Family string `json:"family" validate:"required,oneof=ipv4 ipv6"`
|
|
||||||
HostIP string `json:"hostIP" validate:"required,max=45"`
|
|
||||||
HostPort uint16 `json:"hostPort" validate:"required,min=1"`
|
|
||||||
Protocol string `json:"protocol" validate:"required,oneof=tcp udp"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardPolicyBatch struct {
|
|
||||||
Policies []DockerPortGuardPolicy `json:"policies" validate:"required,min=1,dive"`
|
|
||||||
Import bool `json:"import"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardPolicyBatchDelete struct {
|
|
||||||
UUIDs []string `json:"uuids" validate:"required,min=1,dive,required,max=64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardPolicy struct {
|
|
||||||
DockerPortGuardEndpointIdentity
|
|
||||||
Mode string `json:"mode" validate:"required,oneof=deny_sources allow_sources deny_all accept_sources accept_all"`
|
|
||||||
Sources []string `json:"sources" validate:"dive,required,max=64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DockerPortGuardOperation struct {
|
|
||||||
BackupFile string `json:"backupFile,omitempty" validate:"omitempty,max=255"`
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=initialize bind unbind"`
|
|
||||||
TaskID string `json:"taskID,omitempty" validate:"omitempty,max=64"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleCreateItem struct {
|
|
||||||
Raw string `json:"raw,omitempty"`
|
|
||||||
ParseStatus filter.ParseStatus `json:"parseStatus,omitempty"`
|
|
||||||
Rule filter.FirewallRule `json:"rule" validate:"required"`
|
|
||||||
SourceKind string `json:"sourceKind" validate:"omitempty,oneof=user imported"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleCreate struct {
|
|
||||||
BackupFile string `json:"backupFile,omitempty" validate:"omitempty,max=255"`
|
|
||||||
Initialize bool `json:"initialize"`
|
|
||||||
Items []FirewallRuleCreateItem `json:"items" validate:"dive"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleCreateResponse struct {
|
|
||||||
TaskID string `json:"taskID,omitempty"`
|
|
||||||
Queued bool `json:"queued,omitempty"`
|
|
||||||
Succeeded int `json:"succeeded"`
|
|
||||||
Failed int `json:"failed"`
|
|
||||||
Skipped int `json:"skipped"`
|
|
||||||
Errors []FirewallRuleCreateFailure `json:"errors,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleCreateFailure struct {
|
|
||||||
Index int `json:"index"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Rule filter.FirewallRule `json:"rule"`
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleDelete struct {
|
|
||||||
Targets []FirewallRuleDeleteItem `json:"targets" validate:"required,min=1,dive"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleDeleteItem struct {
|
|
||||||
FirewallRuleDeleteTarget
|
|
||||||
Observed filter.ObservedRule `json:"observed" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleDeleteTarget struct {
|
|
||||||
Scope filter.Scope `json:"scope" validate:"required"`
|
|
||||||
InstanceKey string `json:"instanceKey" validate:"required,max=128"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleDeleteResponse struct {
|
|
||||||
TaskID string `json:"taskID,omitempty"`
|
|
||||||
Queued bool `json:"queued,omitempty"`
|
|
||||||
Succeeded int `json:"succeeded"`
|
|
||||||
Failed int `json:"failed"`
|
|
||||||
Errors []FirewallRuleDeleteFailure `json:"errors,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleDeleteFailure struct {
|
|
||||||
Index int `json:"index"`
|
|
||||||
InstanceKey string `json:"instanceKey"`
|
|
||||||
Error string `json:"error"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleUpdate struct {
|
|
||||||
FirewallRuleDeleteTarget
|
|
||||||
Rule *filter.FirewallRule `json:"rule,omitempty" validate:"required_without_all=Description OrderIndex Priority,excluded_with=Description OrderIndex Priority"`
|
|
||||||
Description *string `json:"description,omitempty" validate:"excluded_with=Rule"`
|
|
||||||
OrderIndex *int64 `json:"orderIndex,omitempty" validate:"excluded_with=Rule Priority"`
|
|
||||||
Priority *int `json:"priority,omitempty" validate:"excluded_with=Rule OrderIndex"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleReorder struct {
|
|
||||||
FirewallRuleDeleteTarget
|
|
||||||
TargetPosition *int64 `json:"targetPosition"`
|
|
||||||
Priority *int `json:"priority"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallRuleExportItem struct {
|
|
||||||
filter.FirewallRule
|
|
||||||
Raw string `json:"raw,omitempty"`
|
|
||||||
ParseStatus filter.ParseStatus `json:"parseStatus,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallSubsystemBackup struct {
|
|
||||||
Families []string `json:"families,omitempty"`
|
|
||||||
Subsystem string `json:"subsystem"`
|
|
||||||
Provider filter.Provider `json:"provider"`
|
|
||||||
Forwarding []forwarding.Rule `json:"forwarding"`
|
|
||||||
Docker *dockerfirewall.PolicyInventory `json:"docker,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
type ForwardRuleSearch struct {
|
|
||||||
PageInfo
|
|
||||||
All bool `json:"all,omitempty"`
|
|
||||||
Info string `json:"info"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Strategy string `json:"strategy"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ForwardRule struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Chain string `json:"chain"`
|
|
||||||
Family string `json:"family"`
|
|
||||||
Address string `json:"address"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
Protocol string `json:"protocol"`
|
|
||||||
Strategy string `json:"strategy"`
|
|
||||||
|
|
||||||
Num string `json:"num"`
|
|
||||||
TargetIP string `json:"targetIP"`
|
|
||||||
TargetPort string `json:"targetPort"`
|
|
||||||
Interface string `json:"interface"`
|
|
||||||
|
|
||||||
UsedStatus string `json:"usedStatus"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ForwardRuleOperate struct {
|
|
||||||
Import bool `json:"import"`
|
|
||||||
Rules []ForwardRuleOperation `json:"rules" validate:"required,min=1,dive"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ForwardRuleOperation struct {
|
|
||||||
Operation string `json:"operation" validate:"required,oneof=add remove"`
|
|
||||||
Num string `json:"num"`
|
|
||||||
Family string `json:"family" validate:"omitempty,oneof=ipv4 ipv6"`
|
|
||||||
Protocol string `json:"protocol" validate:"required,oneof=tcp udp tcp/udp"`
|
|
||||||
Interface string `json:"interface"`
|
|
||||||
Port string `json:"port" validate:"required"`
|
|
||||||
TargetIP string `json:"targetIP"`
|
|
||||||
TargetPort string `json:"targetPort" validate:"required"`
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
type GroupCreate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupSearch struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupUpdate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
IsDefault bool `json:"isDefault"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type GroupInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
IsDefault bool `json:"isDefault"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OperateByType struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SearchTaskLogReq struct {
|
|
||||||
Status string `json:"status"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
PageInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type TaskDTO struct {
|
|
||||||
model.Task
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemLogReq struct {
|
|
||||||
PageSize int `json:"pageSize" validate:"omitempty,min=1,max=500"`
|
|
||||||
Cursor string `json:"cursor"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
Keyword string `json:"keyword"`
|
|
||||||
Priority string `json:"priority"`
|
|
||||||
Service string `json:"service"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemLogRes struct {
|
|
||||||
Source string `json:"source"`
|
|
||||||
Items []SystemLogItem `json:"items"`
|
|
||||||
HasMore bool `json:"hasMore"`
|
|
||||||
NextCursor string `json:"nextCursor"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemLogStatus struct {
|
|
||||||
Source string `json:"source"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
KeywordFilterSupported bool `json:"keywordFilterSupported"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemLogItem struct {
|
|
||||||
Timestamp int64 `json:"-"`
|
|
||||||
Cursor string `json:"-"`
|
|
||||||
Time string `json:"time"`
|
|
||||||
Priority string `json:"priority"`
|
|
||||||
Service string `json:"service"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Raw string `json:"raw"`
|
|
||||||
}
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MonitorSearch struct {
|
|
||||||
Param string `json:"param" validate:"required,oneof=all cpu memory load io network"`
|
|
||||||
IO string `json:"io"`
|
|
||||||
Network string `json:"network"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorData struct {
|
|
||||||
Param string `json:"param"`
|
|
||||||
Date []time.Time `json:"date"`
|
|
||||||
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 {
|
|
||||||
GPUMonitorStatus string `json:"gpuMonitorStatus"`
|
|
||||||
GPUMonitorStoreDays string `json:"gpuMonitorStoreDays"`
|
|
||||||
GPUMonitorInterval string `json:"gpuMonitorInterval"`
|
|
||||||
VLLMMonitorStatus string `json:"vllmMonitorStatus"`
|
|
||||||
VLLMMonitorStoreDays string `json:"vllmMonitorStoreDays"`
|
|
||||||
VLLMMonitorInterval string `json:"vllmMonitorInterval"`
|
|
||||||
MonitorStatus string `json:"monitorStatus"`
|
|
||||||
MonitorStoreDays string `json:"monitorStoreDays"`
|
|
||||||
MonitorInterval string `json:"monitorInterval"`
|
|
||||||
DefaultNetwork string `json:"defaultNetwork"`
|
|
||||||
DefaultIO string `json:"defaultIO"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorSettingUpdate struct {
|
|
||||||
Key string `json:"key" validate:"required,oneof=MonitorStatus MonitorStoreDays MonitorInterval GPUMonitorStatus GPUMonitorStoreDays GPUMonitorInterval VLLMMonitorStatus VLLMMonitorStoreDays VLLMMonitorInterval DefaultNetwork DefaultIO"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorGPUOptions struct {
|
|
||||||
Supported bool `json:"supported"`
|
|
||||||
GPUType string `json:"gpuType"`
|
|
||||||
ChartHide []GPUChartHide `json:"chartHide"`
|
|
||||||
Options []string `json:"options"`
|
|
||||||
}
|
|
||||||
type GPUChartHide struct {
|
|
||||||
DeviceID string `json:"deviceID"`
|
|
||||||
Legacy bool `json:"legacy"`
|
|
||||||
ProductName string `json:"productName"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Process bool `json:"process"`
|
|
||||||
GPU bool `json:"gpu"`
|
|
||||||
Memory bool `json:"memory"`
|
|
||||||
Power bool `json:"power"`
|
|
||||||
PowerLimit bool `json:"powerLimit"`
|
|
||||||
Temperature bool `json:"temperature"`
|
|
||||||
Speed bool `json:"speed"`
|
|
||||||
}
|
|
||||||
type MonitorGPUSearch struct {
|
|
||||||
Aggregation string `json:"aggregation" validate:"omitempty,oneof=avg max"`
|
|
||||||
DeviceID string `json:"deviceID"`
|
|
||||||
Legacy bool `json:"legacy"`
|
|
||||||
ProductName string `json:"productName"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
}
|
|
||||||
type MonitorGPUData struct {
|
|
||||||
MemoryActivity []*float64 `json:"memoryActivity"`
|
|
||||||
EncoderUtil []*float64 `json:"encoderUtil"`
|
|
||||||
DecoderUtil []*float64 `json:"decoderUtil"`
|
|
||||||
JPEGUtil []*float64 `json:"jpegUtil"`
|
|
||||||
OFAUtil []*float64 `json:"ofaUtil"`
|
|
||||||
MediaUtil []*float64 `json:"mediaUtil"`
|
|
||||||
ComputeUtil []*float64 `json:"computeUtil"`
|
|
||||||
CopyUtil []*float64 `json:"copyUtil"`
|
|
||||||
HotspotTemperature []*float64 `json:"hotspotTemperature"`
|
|
||||||
FanRPM []*float64 `json:"fanRPM"`
|
|
||||||
AICPUUtil []*float64 `json:"aiCPUUtil"`
|
|
||||||
CtrlCPUUtil []*float64 `json:"ctrlCPUUtil"`
|
|
||||||
DDRUsed []*float64 `json:"ddrUsed"`
|
|
||||||
DDRTotal []*float64 `json:"ddrTotal"`
|
|
||||||
HBMUsed []*float64 `json:"hbmUsed"`
|
|
||||||
HBMTotal []*float64 `json:"hbmTotal"`
|
|
||||||
DDRBandwidth []*float64 `json:"ddrBandwidth"`
|
|
||||||
HBMBandwidth []*float64 `json:"hbmBandwidth"`
|
|
||||||
MemoryBandwidth []*float64 `json:"memoryBandwidth"`
|
|
||||||
MediaFrequency []*float64 `json:"mediaFrequency"`
|
|
||||||
HugepagesUsed []*float64 `json:"hugepagesUsed"`
|
|
||||||
HugepagesTotal []*float64 `json:"hugepagesTotal"`
|
|
||||||
|
|
||||||
BucketSeconds int64 `json:"bucketSeconds"`
|
|
||||||
SampleCount int64 `json:"sampleCount"`
|
|
||||||
MemoryTemperatureValue []*float64 `json:"memoryTemperatureValue"`
|
|
||||||
FrequencyValue []*float64 `json:"frequencyValue"`
|
|
||||||
MemoryFrequencyValue []*float64 `json:"memoryFrequencyValue"`
|
|
||||||
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 []*float64 `json:"speedValue"`
|
|
||||||
|
|
||||||
ProcessCount []*float64 `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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorVLLMSearch struct {
|
|
||||||
AppInstallID uint `json:"appInstallID" validate:"required"`
|
|
||||||
StartTime time.Time `json:"startTime" validate:"required"`
|
|
||||||
EndTime time.Time `json:"endTime" validate:"required"`
|
|
||||||
Aggregation string `json:"aggregation" validate:"omitempty,oneof=avg max"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorVLLMData struct {
|
|
||||||
SampleCount int64 `json:"sampleCount"`
|
|
||||||
BucketSeconds int64 `json:"bucketSeconds"`
|
|
||||||
Points []model.MonitorVLLM `json:"points"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorVLLMCurrent struct {
|
|
||||||
AppInstallID uint `json:"appInstallID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorVLLMClean struct {
|
|
||||||
AppInstallID uint `json:"appInstallID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type MonitorClean struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=host gpu"`
|
|
||||||
}
|
|
||||||
@@ -1,135 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/nginx/components"
|
|
||||||
)
|
|
||||||
|
|
||||||
type NginxFull struct {
|
|
||||||
Install model.AppInstall
|
|
||||||
Website model.Website
|
|
||||||
ConfigDir string
|
|
||||||
ConfigFile string
|
|
||||||
SiteDir string
|
|
||||||
Dir string
|
|
||||||
RootConfig NginxConfig
|
|
||||||
SiteConfig NginxConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxConfig struct {
|
|
||||||
FilePath string
|
|
||||||
Config *components.Config
|
|
||||||
OldContent string
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxParam struct {
|
|
||||||
UpdateScope string
|
|
||||||
Name string
|
|
||||||
Params []string
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxAuth struct {
|
|
||||||
Username string `json:"username"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxPathAuth struct {
|
|
||||||
Username string `json:"username"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxKey string
|
|
||||||
|
|
||||||
const (
|
|
||||||
Index NginxKey = "index"
|
|
||||||
LimitConn NginxKey = "limit-conn"
|
|
||||||
SSL NginxKey = "ssl"
|
|
||||||
CACHE NginxKey = "cache"
|
|
||||||
HttpPer NginxKey = "http-per"
|
|
||||||
ProxyCache NginxKey = "proxy-cache"
|
|
||||||
Brotli NginxKey = "brotli"
|
|
||||||
)
|
|
||||||
|
|
||||||
// BrotliKeys are served from the panel-managed http.d file rather than
|
|
||||||
// nginx.conf, because the module is optional: its directives must disappear
|
|
||||||
// together with the module, otherwise nginx refuses to start.
|
|
||||||
var BrotliKeys = []string{"brotli", "brotli_comp_level", "brotli_min_length", "brotli_types"}
|
|
||||||
|
|
||||||
var ScopeKeyMap = map[NginxKey][]string{
|
|
||||||
Index: {"index"},
|
|
||||||
LimitConn: {"limit_conn", "limit_rate", "limit_conn_zone"},
|
|
||||||
SSL: {"ssl_certificate", "ssl_certificate_key"},
|
|
||||||
HttpPer: {"server_names_hash_bucket_size", "client_header_buffer_size", "client_max_body_size", "keepalive_timeout", "gzip", "gzip_min_length", "gzip_comp_level", "gzip_types", "gzip_vary", "gzip_proxied"},
|
|
||||||
}
|
|
||||||
|
|
||||||
var StaticFileKeyMap = map[NginxKey]struct {
|
|
||||||
}{
|
|
||||||
SSL: {},
|
|
||||||
CACHE: {},
|
|
||||||
ProxyCache: {},
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxUpstream struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Algorithm string `json:"algorithm"`
|
|
||||||
Servers []NginxUpstreamServer `json:"servers"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxUpstreamServer struct {
|
|
||||||
Server string `json:"server"`
|
|
||||||
Weight int `json:"weight"`
|
|
||||||
FailTimeout int `json:"failTimeout"`
|
|
||||||
FailTimeoutUnit string `json:"failTimeoutUnit"`
|
|
||||||
MaxFails int `json:"maxFails"`
|
|
||||||
MaxConns int `json:"maxConns"`
|
|
||||||
Flag string `json:"flag"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var LBAlgorithms = map[string]struct{}{"ip_hash": {}, "least_conn": {}}
|
|
||||||
|
|
||||||
var RealIPKeys = map[string]struct{}{"X-Forwarded-For": {}, "X-Real-IP": {}, "CF-Connecting-IP": {}}
|
|
||||||
|
|
||||||
type NginxModule struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Custom bool `json:"custom,omitempty"`
|
|
||||||
Script string `json:"script"`
|
|
||||||
Packages []string `json:"packages"`
|
|
||||||
Params string `json:"params"`
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
BuildMode string `json:"buildMode,omitempty"`
|
|
||||||
Provider string `json:"provider,omitempty"`
|
|
||||||
LoadOrder int `json:"loadOrder,omitempty"`
|
|
||||||
Builds []NginxModuleBuild `json:"builds,omitempty"`
|
|
||||||
LastError string `json:"lastError,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxModuleBuild struct {
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
BuildMode string `json:"buildMode"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Hash string `json:"hash"`
|
|
||||||
Target NginxModuleTarget `json:"target"`
|
|
||||||
Artifacts []NginxModuleArtifact `json:"artifacts,omitempty"`
|
|
||||||
Error string `json:"error,omitempty"`
|
|
||||||
BuiltAt time.Time `json:"builtAt,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxModuleTarget struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
OpenRestyVersion string `json:"openrestyVersion"`
|
|
||||||
Architecture string `json:"architecture"`
|
|
||||||
Image string `json:"image,omitempty"`
|
|
||||||
ImageDigest string `json:"imageDigest,omitempty"`
|
|
||||||
BuilderDigest string `json:"builderDigest,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxModuleArtifact struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Checksum string `json:"checksum"`
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
type AppIgnoreUpgradeReq struct {
|
|
||||||
AppID uint `json:"appID" validate:"required"`
|
|
||||||
AppDetailID uint `json:"appDetailID"`
|
|
||||||
Scope string `json:"scope" validate:"required,oneof=all version"`
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
type ReqWithID struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,231 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/files"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FileOption struct {
|
|
||||||
files.FileOption
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileAISearch struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Query string `json:"query" validate:"required"`
|
|
||||||
ResponseLanguage string `json:"responseLanguage,omitempty"`
|
|
||||||
ContainSub *bool `json:"containSub,omitempty"`
|
|
||||||
MaxItems int `json:"maxItems" validate:"omitempty,min=1,max=2000"`
|
|
||||||
MatchCase bool `json:"matchCase"`
|
|
||||||
WholeWord bool `json:"wholeWord"`
|
|
||||||
UseRegex bool `json:"useRegex"`
|
|
||||||
Extensions []string `json:"extensions,omitempty"`
|
|
||||||
MinSize int64 `json:"minSize"`
|
|
||||||
MaxSize int64 `json:"maxSize"`
|
|
||||||
ModifiedAfter string `json:"modifiedAfter,omitempty"`
|
|
||||||
ModifiedBefore string `json:"modifiedBefore,omitempty"`
|
|
||||||
|
|
||||||
MaxScanFiles int `json:"maxScanFiles"`
|
|
||||||
MaxFileBytes int64 `json:"maxFileBytes"`
|
|
||||||
MaxHitsPerFile int `json:"maxHitsPerFile"`
|
|
||||||
MaxTotalHits int `json:"maxTotalHits"`
|
|
||||||
ContentHitsPromptMaxBytes int `json:"contentHitsPromptMaxBytes"`
|
|
||||||
LlmMaxOutputTokens int `json:"llmMaxOutputTokens"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileContentReq struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
IsDetail bool `json:"isDetail"`
|
|
||||||
}
|
|
||||||
type SearchUploadWithPage struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileCreate struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
Mode int64 `json:"mode"`
|
|
||||||
IsLink bool `json:"isLink"`
|
|
||||||
IsSymlink bool `json:"isSymlink"`
|
|
||||||
LinkPath string `json:"linkPath"`
|
|
||||||
Sub bool `json:"sub"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileRoleReq struct {
|
|
||||||
Paths []string `json:"paths" validate:"required"`
|
|
||||||
Mode int64 `json:"mode" validate:"required"`
|
|
||||||
User string `json:"user" validate:"required"`
|
|
||||||
Group string `json:"group" validate:"required"`
|
|
||||||
Sub bool `json:"sub"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileDelete struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
ForceDelete bool `json:"forceDelete"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileBatchDelete struct {
|
|
||||||
Paths []string `json:"paths" validate:"required"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileCompress struct {
|
|
||||||
Files []string `json:"files" validate:"required"`
|
|
||||||
Dst string `json:"dst" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Replace bool `json:"replace"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileCompressStopReq struct {
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileDeCompress struct {
|
|
||||||
Dst string `json:"dst" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileDeCompressStopReq struct {
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileEdit struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileRename struct {
|
|
||||||
OldName string `json:"oldName" validate:"required"`
|
|
||||||
NewName string `json:"newName" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FilePathCheck struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
WithInit bool `json:"withInit"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FilePathsCheck struct {
|
|
||||||
Paths []string `json:"paths" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileWget struct {
|
|
||||||
Url string `json:"url" validate:"required"`
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
IgnoreCertificate bool `json:"ignoreCertificate"`
|
|
||||||
UseProxy bool `json:"useProxy"`
|
|
||||||
UseServerFilename bool `json:"useServerFilename"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileMove struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
OldPaths []string `json:"oldPaths" validate:"required"`
|
|
||||||
NewPath string `json:"newPath" validate:"required"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Cover bool `json:"cover"`
|
|
||||||
CoverPaths []string `json:"coverPaths"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileMoveStopReq struct {
|
|
||||||
TaskID string `json:"taskID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileDownload struct {
|
|
||||||
Paths []string `json:"paths" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Compress bool `json:"compress"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileChunkDownload struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DirSizeReq struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileProcessReq struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileProcessRemoveReq struct {
|
|
||||||
Keys []string `json:"keys" validate:"required,min=1,max=1000"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileRoleUpdate struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
User string `json:"user" validate:"required"`
|
|
||||||
Group string `json:"group" validate:"required"`
|
|
||||||
Sub bool `json:"sub"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileReadByLineReq struct {
|
|
||||||
Page int `json:"page" validate:"required"`
|
|
||||||
PageSize int `json:"pageSize" validate:"required"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
ID uint `json:"ID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Latest bool `json:"latest"`
|
|
||||||
TaskReq
|
|
||||||
}
|
|
||||||
|
|
||||||
type TaskLogReadReq struct {
|
|
||||||
Page int `json:"page" validate:"required,min=1"`
|
|
||||||
PageSize int `json:"pageSize" validate:"required,min=1"`
|
|
||||||
Latest bool `json:"latest"`
|
|
||||||
TaskReq
|
|
||||||
}
|
|
||||||
|
|
||||||
type TaskReq struct {
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
TaskType string `json:"taskType"`
|
|
||||||
TaskOperate string `json:"taskOperate"`
|
|
||||||
ResourceID uint `json:"resourceID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileExistReq struct {
|
|
||||||
Name string `json:"name" 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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileShareCreate struct {
|
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
ExpireMinutes int `json:"expireMinutes" validate:"min=0,max=10080"`
|
|
||||||
Password *string `json:"password"`
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FileHistorySearchReq struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Path string `json:"path"`
|
|
||||||
Scope string `json:"scope" validate:"required,oneof=current all"`
|
|
||||||
Operation string `json:"operation"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistoryContentReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistoryIDs []uint
|
|
||||||
|
|
||||||
func (ids *FileHistoryIDs) UnmarshalJSON(data []byte) error {
|
|
||||||
type alias []uint
|
|
||||||
var direct alias
|
|
||||||
if err := json.Unmarshal(data, &direct); err == nil {
|
|
||||||
*ids = FileHistoryIDs(direct)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var wrapped struct {
|
|
||||||
IDs []uint `json:"ids"`
|
|
||||||
}
|
|
||||||
if err := json.Unmarshal(data, &wrapped); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
*ids = FileHistoryIDs(wrapped.IDs)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistoryDeleteReq struct {
|
|
||||||
IDs FileHistoryIDs `json:"ids" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistoryRestoreReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistorySettingUpdate struct {
|
|
||||||
Enable string `json:"enable" validate:"required,oneof=Enable Disable"`
|
|
||||||
MaxPerPath int `json:"maxPerPath" validate:"min=0,max=1000"`
|
|
||||||
DiskQuotaMB int `json:"diskQuotaMB" validate:"min=0,max=1048576"`
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
type HostToolTypeReq struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=supervisord"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostToolOperateReq struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=supervisord"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=restart start stop"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostToolCreate struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
SupervisorConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type SupervisorConfig struct {
|
|
||||||
ConfigPath string `json:"configPath"`
|
|
||||||
ServiceName string `json:"serviceName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostToolConfigUpdate struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=supervisord"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SupervisorProcessConfig struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Operate string `json:"operate"`
|
|
||||||
Command string `json:"command"`
|
|
||||||
User string `json:"user"`
|
|
||||||
Dir string `json:"dir"`
|
|
||||||
Numprocs string `json:"numprocs"`
|
|
||||||
AutoRestart string `json:"autoRestart"`
|
|
||||||
AutoStart string `json:"autoStart"`
|
|
||||||
Environment string `json:"environment"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SupervisorProcessFileReq struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=get clear update" `
|
|
||||||
Content string `json:"content"`
|
|
||||||
File string `json:"file" validate:"required,oneof=out.log err.log config"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostSupervisorProcessFileGetReq struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
File string `json:"file" validate:"required,oneof=out.log err.log config"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type HostSupervisorProcessFileOperateReq struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=clear update"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
File string `json:"file" validate:"required,oneof=out.log err.log config"`
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import "github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
|
|
||||||
type McpServerSearch struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Name string `json:"name"`
|
|
||||||
Sync bool `json:"sync"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerCreate struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Command string `json:"command" validate:"required"`
|
|
||||||
Environments []Environment `json:"environments"`
|
|
||||||
Volumes []Volume `json:"volumes"`
|
|
||||||
Port int `json:"port" validate:"required"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
SsePath string `json:"ssePath"`
|
|
||||||
HostIP string `json:"hostIP"`
|
|
||||||
StreamableHttpPath string `json:"streamableHttpPath"`
|
|
||||||
OutputTransport string `json:"outputTransport" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
GatewayImage string `json:"gatewayImage"`
|
|
||||||
ProtocolVersion string `json:"protocolVersion"`
|
|
||||||
GatewayArgs string `json:"gatewayArgs" validate:"max=4096"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
McpServerCreate
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerDelete struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerDetail struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerStatusSync struct {
|
|
||||||
IDs []uint `json:"ids"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerOperate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Operate string `json:"operate" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpServerConnectionTest struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpBindDomain struct {
|
|
||||||
Domain string `json:"domain" validate:"required"`
|
|
||||||
SSLID uint `json:"sslID"`
|
|
||||||
IPList string `json:"ipList"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type McpBindDomainUpdate struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
SSLID uint `json:"sslID"`
|
|
||||||
IPList string `json:"ipList"`
|
|
||||||
}
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RuntimeSearch struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Type string `json:"type"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeCreate struct {
|
|
||||||
AppDetailID uint `json:"appDetailId"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Resource string `json:"resource"`
|
|
||||||
Image string `json:"image"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
CodeDir string `json:"codeDir"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
|
|
||||||
Params map[string]interface{} `json:"params"`
|
|
||||||
NodeConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodeConfig struct {
|
|
||||||
Install *bool `json:"install"`
|
|
||||||
Clean bool `json:"clean"`
|
|
||||||
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
|
||||||
Environments []Environment `json:"environments"`
|
|
||||||
Volumes []Volume `json:"volumes"`
|
|
||||||
ExtraHosts []ExtraHost `json:"extraHosts"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Environment struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
type Volume struct {
|
|
||||||
Source string `json:"source"`
|
|
||||||
Target string `json:"target"`
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExposedPort struct {
|
|
||||||
HostPort int `json:"hostPort"`
|
|
||||||
ContainerPort int `json:"containerPort"`
|
|
||||||
HostIP string `json:"hostIP"`
|
|
||||||
Protocol string `json:"protocol"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExtraHost struct {
|
|
||||||
Hostname string `json:"hostname"`
|
|
||||||
IP string `json:"ip"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeDelete struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
ForceDelete bool `json:"forceDelete"`
|
|
||||||
DeleteImage bool `json:"deleteImage"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeUpdate struct {
|
|
||||||
AppDetailID uint `json:"appDetailId"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Image string `json:"image"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Rebuild bool `json:"rebuild"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
CodeDir string `json:"codeDir"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
|
|
||||||
Params map[string]interface{} `json:"params"`
|
|
||||||
NodeConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodePackageReq struct {
|
|
||||||
CodeDir string `json:"codeDir"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeOperate struct {
|
|
||||||
Operate string `json:"operate"`
|
|
||||||
ID uint `json:"ID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodeModuleOperateReq struct {
|
|
||||||
Operate string `json:"operate" validate:"oneof=install uninstall update"`
|
|
||||||
ID uint `json:"ID" validate:"required"`
|
|
||||||
Module string `json:"module"`
|
|
||||||
PkgManager string `json:"pkgManager" validate:"oneof=npm yarn"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodeModuleReq struct {
|
|
||||||
ID uint `json:"ID" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPExtensionInstallReq struct {
|
|
||||||
ID uint `json:"ID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPConfigUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Params map[string]string `json:"params"`
|
|
||||||
Scope string `json:"scope" validate:"required"`
|
|
||||||
DisableFunctions []string `json:"disableFunctions"`
|
|
||||||
UploadMaxSize string `json:"uploadMaxSize"`
|
|
||||||
MaxExecutionTime string `json:"maxExecutionTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPFileUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPFileReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FPMConfig struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Params map[string]interface{} `json:"params" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPSupervisorProcessConfig struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
SupervisorProcessConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPSupervisorProcessFileReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
SupervisorProcessFileReq
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPContainerConfig struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
ExposedPorts []ExposedPort `json:"exposedPorts"`
|
|
||||||
Environments []Environment `json:"environments"`
|
|
||||||
Volumes []Volume `json:"volumes"`
|
|
||||||
ExtraHosts []ExtraHost `json:"extraHosts"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeRemark struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,393 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type WebsiteSearch struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Name string `json:"name"`
|
|
||||||
OrderBy string `json:"orderBy" validate:"required,oneof=primary_domain type status createdAt expire_date created_at favorite"`
|
|
||||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
|
||||||
WebsiteGroupID uint `json:"websiteGroupId"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteCreate struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Alias string `json:"alias" validate:"required"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
Proxy string `json:"proxy"`
|
|
||||||
WebsiteGroupID uint `json:"webSiteGroupID" validate:"required"`
|
|
||||||
IPV6 bool `json:"IPV6"`
|
|
||||||
|
|
||||||
Domains []WebsiteDomain `json:"domains"`
|
|
||||||
|
|
||||||
AppType string `json:"appType" validate:"oneof=new installed"`
|
|
||||||
AppInstall NewAppInstall `json:"appInstall"`
|
|
||||||
AppID uint `json:"appID"`
|
|
||||||
AppInstallID uint `json:"appInstallID"`
|
|
||||||
|
|
||||||
RuntimeID uint `json:"runtimeID"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
ParentWebsiteID uint `json:"parentWebsiteID"`
|
|
||||||
|
|
||||||
SiteDir string `json:"siteDir"`
|
|
||||||
|
|
||||||
TemplateOutputID uint `json:"templateOutputID"`
|
|
||||||
|
|
||||||
RuntimeConfig
|
|
||||||
FtpConfig
|
|
||||||
DataBaseConfig
|
|
||||||
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 {
|
|
||||||
Types []string `json:"types"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeConfig struct {
|
|
||||||
ProxyType string `json:"proxyType"`
|
|
||||||
Port int `json:"port"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FtpConfig struct {
|
|
||||||
FtpUser string `json:"ftpUser"`
|
|
||||||
FtpPassword string `json:"ftpPassword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DataBaseConfig struct {
|
|
||||||
CreateDb bool `json:"createDb"`
|
|
||||||
DbName string `json:"dbName"`
|
|
||||||
DbUser string `json:"dbUser"`
|
|
||||||
DbPassword string `json:"dbPassword"`
|
|
||||||
DbHost string `json:"dbHost"`
|
|
||||||
DBFormat string `json:"dbFormat"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSLConfig struct {
|
|
||||||
EnableSSL bool `json:"enableSSL"`
|
|
||||||
WebsiteSSLID uint `json:"websiteSSLID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NewAppInstall struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
AppDetailId uint `json:"appDetailID"`
|
|
||||||
Params map[string]interface{} `json:"params"`
|
|
||||||
|
|
||||||
AppContainerConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteInstallCheckReq struct {
|
|
||||||
InstallIds []uint `json:"InstallIds"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
PrimaryDomain string `json:"primaryDomain" validate:"required"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
WebsiteGroupID uint `json:"webSiteGroupID"`
|
|
||||||
ExpireDate string `json:"expireDate"`
|
|
||||||
IPV6 bool `json:"IPV6"`
|
|
||||||
Favorite bool `json:"favorite"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDelete struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
DeleteApp bool `json:"deleteApp"`
|
|
||||||
DeleteBackup bool `json:"deleteBackup"`
|
|
||||||
ForceDelete bool `json:"forceDelete"`
|
|
||||||
DeleteDB bool `json:"deleteDB"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteOp struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
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 {
|
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
|
||||||
Key string `json:"key" validate:"required"`
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteRecover struct {
|
|
||||||
WebsiteName string `json:"websiteName" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
BackupName string `json:"backupName" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteRecoverByFile struct {
|
|
||||||
WebsiteName string `json:"websiteName" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
FileDir string `json:"fileDir" validate:"required"`
|
|
||||||
FileName string `json:"fileName" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteGroupCreate struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteGroupUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Default bool `json:"default"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDomainCreate struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Domains []WebsiteDomain `json:"domains" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDomainUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
SSL bool `json:"ssl"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDomain struct {
|
|
||||||
Domain string `json:"domain" validate:"required"`
|
|
||||||
Port int `json:"port"`
|
|
||||||
SSL bool `json:"ssl"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDomainDelete struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteHTTPSOp struct {
|
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
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 WebsiteNginxUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLogReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Operate string `json:"operate" validate:"required,oneof=enable disable delete"`
|
|
||||||
LogType string `json:"logType" validate:"required,oneof=access.log error.log"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLogSearchReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
LogType string `json:"logType" validate:"required,oneof=access.log error.log"`
|
|
||||||
Page int `json:"page"`
|
|
||||||
PageSize int `json:"pageSize"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteDefaultUpdate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsitePHPVersionReq struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
RuntimeID uint `json:"runtimeID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteUpdateDir struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
SiteDir string `json:"siteDir" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteUpdateDirPermission struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
User string `json:"user" validate:"required"`
|
|
||||||
Group string `json:"group" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteProxyConfig struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Operate string `json:"operate" validate:"required"`
|
|
||||||
Enable bool `json:"enable" `
|
|
||||||
Cache bool `json:"cache" `
|
|
||||||
CacheTime int `json:"cacheTime"`
|
|
||||||
CacheUnit string `json:"cacheUnit"`
|
|
||||||
ServerCacheTime int `json:"serverCacheTime"`
|
|
||||||
ServerCacheUnit string `json:"serverCacheUnit"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Modifier string `json:"modifier"`
|
|
||||||
Match string `json:"match" validate:"required"`
|
|
||||||
ProxyPass string `json:"proxyPass" validate:"required"`
|
|
||||||
ProxyHost string `json:"proxyHost" validate:"required"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
FilePath string `json:"filePath"`
|
|
||||||
Replaces map[string]string `json:"replaces"`
|
|
||||||
SNI bool `json:"sni"`
|
|
||||||
ProxySSLName string `json:"proxySSLName"`
|
|
||||||
SSLVerify bool `json:"sslVerify"`
|
|
||||||
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 {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteRedirectReq struct {
|
|
||||||
WebsiteID uint `json:"websiteId" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteCommonReq struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WafWebsite struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Domains []string `json:"domains"`
|
|
||||||
Host []string `json:"host"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteHtmlReq struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteHtmlUpdate struct {
|
|
||||||
Type string `json:"type" validate:"required"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
Sync bool `json:"sync"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLBCreate struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Algorithm string `json:"algorithm"`
|
|
||||||
Servers []dto.NginxUpstreamServer `json:"servers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLBUpdate struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Algorithm string `json:"algorithm"`
|
|
||||||
Servers []dto.NginxUpstreamServer `json:"servers"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLBDelete struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteLBUpdateFile struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Content string `json:"content" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteRealIP struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
Open bool `json:"open"`
|
|
||||||
IPFrom string `json:"ipFrom"`
|
|
||||||
IPHeader string `json:"ipHeader"`
|
|
||||||
IPOther string `json:"ipOther"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChangeDatabase struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
DatabaseID uint `json:"databaseID" `
|
|
||||||
DatabaseType string `json:"databaseType" `
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteProxyDel struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CrossSiteAccessOp struct {
|
|
||||||
WebsiteID uint `json:"websiteID" validate:"required"`
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package request
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type WebsiteTemplateSearch struct {
|
|
||||||
dto.PageInfo
|
|
||||||
Name string `json:"name"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteTemplateCreate struct {
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=single multi"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
FilePath string `json:"filePath"`
|
|
||||||
Variables string `json:"variables"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteTemplateUpdate struct {
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
Type string `json:"type" validate:"required,oneof=single multi"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
FilePath string `json:"filePath"`
|
|
||||||
Variables string `json:"variables"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteTemplateOutputSearch struct {
|
|
||||||
dto.PageInfo
|
|
||||||
TemplateID uint `json:"templateID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteTemplateOutputCreate struct {
|
|
||||||
TemplateID uint `json:"templateID" validate:"required"`
|
|
||||||
Name string `json:"name" validate:"required"`
|
|
||||||
VariableValues map[string]string `json:"variableValues"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsitePreviewReq struct {
|
|
||||||
TemplateID uint `json:"templateID" validate:"required"`
|
|
||||||
VariableValues map[string]string `json:"variableValues"`
|
|
||||||
}
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AppRes struct {
|
|
||||||
Items []*AppItem `json:"items"`
|
|
||||||
Total int64 `json:"total"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppUpdateRes struct {
|
|
||||||
CanUpdate bool `json:"canUpdate"`
|
|
||||||
IsSyncing bool `json:"isSyncing"`
|
|
||||||
AppStoreLastModified int `json:"appStoreLastModified"`
|
|
||||||
AppList *dto.AppList `json:"appList"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppDTO struct {
|
|
||||||
model.App
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
Versions []string `json:"versions"`
|
|
||||||
Tags []TagDTO `json:"tags"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppItem struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Key string `json:"key"`
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
Limit int `json:"limit"`
|
|
||||||
Tags []string `json:"tags"`
|
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
|
||||||
Recommend int `json:"recommend"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
BatchInstallSupport bool `json:"batchInstallSupport"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TagDTO struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Key string `json:"key"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppInstalledCheck struct {
|
|
||||||
IsExist bool `json:"isExist"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
App string `json:"app"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
LastBackupAt string `json:"lastBackupAt"`
|
|
||||||
AppInstallID uint `json:"appInstallId"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
InstallPath string `json:"installPath"`
|
|
||||||
HttpPort int `json:"httpPort"`
|
|
||||||
HttpsPort int `json:"httpsPort"`
|
|
||||||
WebsiteDir string `json:"websiteDir"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppDetailDTO struct {
|
|
||||||
model.AppDetail
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
Params interface{} `json:"params"`
|
|
||||||
Image string `json:"image"`
|
|
||||||
HostMode bool `json:"hostMode"`
|
|
||||||
Architectures string `json:"architectures"`
|
|
||||||
MemoryRequired int `json:"memoryRequired"`
|
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppDetailSimpleDTO struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type IgnoredApp struct {
|
|
||||||
Icon string `json:"icon"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
DetailID uint `json:"detailID"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppInstalledDTO struct {
|
|
||||||
model.AppInstall
|
|
||||||
Total int `json:"total"`
|
|
||||||
Ready int `json:"ready"`
|
|
||||||
AppName string `json:"appName"`
|
|
||||||
Icon string `json:"icon"`
|
|
||||||
CanUpdate bool `json:"canUpdate"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppDetail struct {
|
|
||||||
Website string `json:"website"`
|
|
||||||
Document string `json:"document"`
|
|
||||||
Github string `json:"github"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppInstallDTO struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
AppID uint `json:"appID"`
|
|
||||||
AppDetailID uint `json:"appDetailID"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
HttpPort int `json:"httpPort"`
|
|
||||||
HttpsPort int `json:"httpsPort"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
CanUpdate bool `json:"canUpdate"`
|
|
||||||
Icon string `json:"icon"`
|
|
||||||
AppName string `json:"appName"`
|
|
||||||
Ready int `json:"ready"`
|
|
||||||
Total int `json:"total"`
|
|
||||||
AppKey string `json:"appKey"`
|
|
||||||
AppType string `json:"appType"`
|
|
||||||
AppStatus string `json:"appStatus"`
|
|
||||||
DockerCompose string `json:"dockerCompose"`
|
|
||||||
WebUI string `json:"webUI"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
Favorite bool `json:"favorite"`
|
|
||||||
SortOrder int `json:"sortOrder"`
|
|
||||||
App AppDetail `json:"app"`
|
|
||||||
Container string `json:"container"`
|
|
||||||
IsEdit bool `json:"isEdit"`
|
|
||||||
LinkDB bool `json:"linkDB"`
|
|
||||||
ResourceKeys []string `json:"resourceKeys"`
|
|
||||||
ServiceName string `json:"serviceName"`
|
|
||||||
Env map[string]interface{} `json:"env"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
Status string `json:"status"`
|
|
||||||
Username string `json:"username"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
ContainerName string `json:"containerName"`
|
|
||||||
ServiceName string `json:"serviceName"`
|
|
||||||
Port int64 `json:"port"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppService struct {
|
|
||||||
Label string `json:"label"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
Config interface{} `json:"config"`
|
|
||||||
From string `json:"from"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppParam struct {
|
|
||||||
Value interface{} `json:"value"`
|
|
||||||
Edit bool `json:"edit"`
|
|
||||||
Key string `json:"key"`
|
|
||||||
Rule string `json:"rule"`
|
|
||||||
LabelZh string `json:"labelZh"`
|
|
||||||
LabelEn string `json:"labelEn"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Values interface{} `json:"values"`
|
|
||||||
ShowValue string `json:"showValue"`
|
|
||||||
Required bool `json:"required"`
|
|
||||||
Multiple bool `json:"multiple"`
|
|
||||||
Label dto.Locale `json:"label"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AppConfig struct {
|
|
||||||
Params []AppParam `json:"params"`
|
|
||||||
RawCompose string `json:"rawCompose"`
|
|
||||||
request.AppContainerConfig
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
type AppIgnoreUpgradeDTO struct {
|
|
||||||
ID uint `json:"ID"`
|
|
||||||
AppID uint `json:"appID"`
|
|
||||||
AppDetailID uint `json:"appDetailID"`
|
|
||||||
Scope string `json:"scope"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
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,125 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/utils/files"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FileInfo struct {
|
|
||||||
files.FileInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
type UploadInfo struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Size int `json:"size"`
|
|
||||||
CreatedAt string `json:"createdAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileTree struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
Extension string `json:"extension"`
|
|
||||||
Children []FileTree `json:"children"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DirSizeRes struct {
|
|
||||||
Size int64 `json:"size" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileProcessKeys struct {
|
|
||||||
Keys []string `json:"keys"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileWgetRes struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileLineContent struct {
|
|
||||||
End bool `json:"end"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Total int `json:"total"`
|
|
||||||
TaskStatus string `json:"taskStatus"`
|
|
||||||
Lines []string `json:"lines"`
|
|
||||||
Scope string `json:"scope"`
|
|
||||||
TotalLines int `json:"totalLines"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileExist struct {
|
|
||||||
Exist bool `json:"exist"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ExistFileInfo struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
ModTime time.Time `json:"modTime"`
|
|
||||||
IsDir bool `json:"isDir"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserInfo struct {
|
|
||||||
Username string `json:"username"`
|
|
||||||
Group string `json:"group"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserGroupResponse struct {
|
|
||||||
Users []UserInfo `json:"users"`
|
|
||||||
Groups []string `json:"groups"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type DepthDirSizeRes struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileShareInfo struct {
|
|
||||||
Code string `json:"code"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
ExpiresAt int64 `json:"expiresAt"`
|
|
||||||
Permanent bool `json:"permanent"`
|
|
||||||
HasPassword bool `json:"hasPassword"`
|
|
||||||
Password string `json:"password,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileSharePublicInfo struct {
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
ExpiresAt int64 `json:"expiresAt"`
|
|
||||||
Permanent bool `json:"permanent"`
|
|
||||||
HasPassword bool `json:"hasPassword"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileAIContentHit struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
Line int `json:"line"`
|
|
||||||
Text string `json:"text"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileAISearchResult struct {
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
Summary string `json:"summary"`
|
|
||||||
Hits []FileAIContentHit `json:"hits"`
|
|
||||||
ContentScannedFiles int `json:"contentScannedFiles"`
|
|
||||||
ContentHitsTruncated bool `json:"contentHitsTruncated"`
|
|
||||||
Truncated bool `json:"truncated"`
|
|
||||||
PreFiltered bool `json:"preFiltered"`
|
|
||||||
ItemCount int `json:"itemCount"`
|
|
||||||
PromptTokens int `json:"promptTokens"`
|
|
||||||
CompletionTokens int `json:"completionTokens"`
|
|
||||||
TotalTokens int `json:"totalTokens"`
|
|
||||||
Duration string `json:"duration"`
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type FileHistoryInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
FileID string `json:"fileId"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
CurrentPath string `json:"currentPath"`
|
|
||||||
PreviousID uint `json:"previousId"`
|
|
||||||
SourcePath string `json:"sourcePath"`
|
|
||||||
TargetPath string `json:"targetPath"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
Extension string `json:"extension"`
|
|
||||||
FileMode string `json:"fileMode"`
|
|
||||||
Operation string `json:"operation"`
|
|
||||||
Deleted bool `json:"deleted"`
|
|
||||||
ContentSize int64 `json:"contentSize"`
|
|
||||||
ContentSHA string `json:"contentSHA"`
|
|
||||||
StoragePath string `json:"storagePath,omitempty"`
|
|
||||||
Content string `json:"content,omitempty"`
|
|
||||||
CurrentContent string `json:"currentContent,omitempty"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileHistorySettingInfo struct {
|
|
||||||
Enable string `json:"enable"`
|
|
||||||
MaxPerPath int `json:"maxPerPath"`
|
|
||||||
DiskQuotaMB int `json:"diskQuotaMB"`
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import "github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
||||||
|
|
||||||
type NginxStatus struct {
|
|
||||||
Active int `json:"active"`
|
|
||||||
Accepts int `json:"accepts"`
|
|
||||||
Handled int `json:"handled"`
|
|
||||||
Requests int `json:"requests"`
|
|
||||||
Reading int `json:"reading"`
|
|
||||||
Writing int `json:"writing"`
|
|
||||||
Waiting int `json:"waiting"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxParam struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Params []string `json:"params"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// NginxBrotliRes carries the brotli settings together with where they live.
|
|
||||||
// ManagedExternally is true when the user defined brotli by hand, in which
|
|
||||||
// case the panel only reports the values and must not write its own copy.
|
|
||||||
// ManagedUnavailable is true when the panel could not wire the managed
|
|
||||||
// configuration into nginx.conf at all, so the reported values are inert.
|
|
||||||
type NginxBrotliRes struct {
|
|
||||||
Params []NginxParam `json:"params"`
|
|
||||||
ManagedExternally bool `json:"managedExternally"`
|
|
||||||
ManagedUnavailable bool `json:"managedUnavailable"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxAuthRes struct {
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
Items []dto.NginxAuth `json:"items"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxPathAuthRes struct {
|
|
||||||
dto.NginxPathAuth
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxAntiLeechRes struct {
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
Extends string `json:"extends"`
|
|
||||||
Return string `json:"return"`
|
|
||||||
ServerNames []string `json:"serverNames"`
|
|
||||||
Cache bool `json:"cache"`
|
|
||||||
CacheTime int `json:"cacheTime"`
|
|
||||||
CacheUint string `json:"cacheUint"`
|
|
||||||
NoneRef bool `json:"noneRef"`
|
|
||||||
LogEnable bool `json:"logEnable"`
|
|
||||||
Blocked bool `json:"blocked"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxRedirectConfig struct {
|
|
||||||
WebsiteID uint `json:"websiteID"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Domains []string `json:"domains"`
|
|
||||||
KeepPath bool `json:"keepPath"`
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Redirect string `json:"redirect"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Target string `json:"target"`
|
|
||||||
FilePath string `json:"filePath"`
|
|
||||||
Content string `json:"content"`
|
|
||||||
RedirectRoot bool `json:"redirectRoot"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxFile struct {
|
|
||||||
Content string `json:"content"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxProxyCache struct {
|
|
||||||
Open bool `json:"open"`
|
|
||||||
CacheLimit float64 `json:"cacheLimit"`
|
|
||||||
CacheLimitUnit string `json:"cacheLimitUnit" `
|
|
||||||
ShareCache int `json:"shareCache" `
|
|
||||||
ShareCacheUnit string `json:"shareCacheUnit" `
|
|
||||||
CacheExpire int `json:"cacheExpire" `
|
|
||||||
CacheExpireUnit string `json:"cacheExpireUnit" `
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxModule struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Custom bool `json:"custom"`
|
|
||||||
Script string `json:"script"`
|
|
||||||
Packages string `json:"packages"`
|
|
||||||
Params string `json:"params"`
|
|
||||||
Enable bool `json:"enable"`
|
|
||||||
BuildMode string `json:"buildMode"`
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
LoadOrder int `json:"loadOrder"`
|
|
||||||
BuildStatus string `json:"buildStatus"`
|
|
||||||
LoadStatus string `json:"loadStatus"`
|
|
||||||
Artifacts []dto.NginxModuleArtifact `json:"artifacts"`
|
|
||||||
LastError string `json:"lastError"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxBuildConfig struct {
|
|
||||||
Mirror string `json:"mirror"`
|
|
||||||
DynamicSupported bool `json:"dynamicSupported"`
|
|
||||||
Modules []NginxModule `json:"modules"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type NginxConfigRes struct {
|
|
||||||
Https bool `json:"https"`
|
|
||||||
SSLRejectHandshake bool `json:"sslRejectHandshake"`
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto/request"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RuntimeDTO struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Resource string `json:"resource"`
|
|
||||||
AppDetailID uint `json:"appDetailID"`
|
|
||||||
AppID uint `json:"appID"`
|
|
||||||
Source string `json:"source"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
Image string `json:"image"`
|
|
||||||
Params map[string]interface{} `json:"params"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
CodeDir string `json:"codeDir"`
|
|
||||||
AppParams []AppParam `json:"appParams"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
ExposedPorts []request.ExposedPort `json:"exposedPorts"`
|
|
||||||
Environments []request.Environment `json:"environments"`
|
|
||||||
Volumes []request.Volume `json:"volumes"`
|
|
||||||
ExtraHosts []request.ExtraHost `json:"extraHosts"`
|
|
||||||
ContainerStatus string `json:"containerStatus"`
|
|
||||||
Container string `json:"container"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PackageScripts struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Script string `json:"script"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRuntimeDTO(runtime model.Runtime) RuntimeDTO {
|
|
||||||
return RuntimeDTO{
|
|
||||||
ID: runtime.ID,
|
|
||||||
Name: runtime.Name,
|
|
||||||
Resource: runtime.Resource,
|
|
||||||
AppDetailID: runtime.AppDetailID,
|
|
||||||
Status: runtime.Status,
|
|
||||||
Type: runtime.Type,
|
|
||||||
Image: runtime.Image,
|
|
||||||
Message: runtime.Message,
|
|
||||||
CreatedAt: runtime.CreatedAt,
|
|
||||||
CodeDir: runtime.CodeDir,
|
|
||||||
Version: runtime.Version,
|
|
||||||
Port: runtime.Port,
|
|
||||||
Path: runtime.GetPath(),
|
|
||||||
Container: runtime.ContainerName,
|
|
||||||
Remark: runtime.Remark,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type NodeModule struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
License string `json:"license"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SupportExtension struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Installed bool `json:"installed"`
|
|
||||||
Check string `json:"check"`
|
|
||||||
Versions []string `json:"versions"`
|
|
||||||
File string `json:"file"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type PHPExtensionRes struct {
|
|
||||||
Extensions []string `json:"extensions"`
|
|
||||||
SupportExtensions []SupportExtension `json:"supportExtensions"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FpmStatusItem struct {
|
|
||||||
Key string `json:"key"`
|
|
||||||
Value interface{} `json:"value"`
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
type ComponentInfo struct {
|
|
||||||
Exists bool `json:"exists"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Error string `json:"error"`
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
package response
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package response
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type WebsiteTemplateDTO struct {
|
|
||||||
model.WebsiteTemplate
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsiteTemplateOutputDTO struct {
|
|
||||||
model.WebsiteTemplateOutput
|
|
||||||
TemplateName string `json:"templateName"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type WebsitePreviewDTO struct {
|
|
||||||
HTML string `json:"html"`
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type RuntimeDiagnosticsSummary struct {
|
|
||||||
RSS uint64 `json:"rss"`
|
|
||||||
HeapAlloc uint64 `json:"heapAlloc"`
|
|
||||||
HeapObjects uint64 `json:"heapObjects"`
|
|
||||||
Goroutines int `json:"goroutines"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeGoroutineGroup struct {
|
|
||||||
State string `json:"state"`
|
|
||||||
Top string `json:"top"`
|
|
||||||
Count int `json:"count"`
|
|
||||||
Stack []string `json:"stack"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeGoroutineSnapshot struct {
|
|
||||||
Total int `json:"total"`
|
|
||||||
GroupCount int `json:"groupCount"`
|
|
||||||
Truncated bool `json:"truncated"`
|
|
||||||
CapturedAt time.Time `json:"capturedAt"`
|
|
||||||
Goroutines []RuntimeGoroutineGroup `json:"goroutines"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RuntimeProfileCreate struct {
|
|
||||||
Type string `json:"type" validate:"required,oneof=cpu heap goroutine mutex block"`
|
|
||||||
Duration int `json:"duration" validate:"omitempty,min=5,max=30"`
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
type SettingInfo struct {
|
|
||||||
DockerSockPath string `json:"dockerSockPath"`
|
|
||||||
SystemVersion string `json:"systemVersion"`
|
|
||||||
SystemIP string `json:"systemIP"`
|
|
||||||
|
|
||||||
LocalTime string `json:"localTime"`
|
|
||||||
TimeZone string `json:"timeZone"`
|
|
||||||
NtpSite string `json:"ntpSite"`
|
|
||||||
|
|
||||||
DefaultNetwork string `json:"defaultNetwork"`
|
|
||||||
DefaultIO string `json:"defaultIO"`
|
|
||||||
LastCleanTime string `json:"lastCleanTime"`
|
|
||||||
LastCleanSize string `json:"lastCleanSize"`
|
|
||||||
LastCleanData string `json:"lastCleanData"`
|
|
||||||
|
|
||||||
MonitorStatus string `json:"monitorStatus"`
|
|
||||||
MonitorInterval string `json:"monitorInterval"`
|
|
||||||
MonitorStoreDays string `json:"monitorStoreDays"`
|
|
||||||
|
|
||||||
AppStoreVersion string `json:"appStoreVersion"`
|
|
||||||
AppStoreLastModified string `json:"appStoreLastModified"`
|
|
||||||
AppStoreSyncStatus string `json:"appStoreSyncStatus"`
|
|
||||||
|
|
||||||
FileRecycleBin string `json:"fileRecycleBin"`
|
|
||||||
LocalSSHConnShow string `json:"localSSHConnShow"`
|
|
||||||
|
|
||||||
FirewallPortWhiteList string `json:"firewallPortWhiteList"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SettingUpdate struct {
|
|
||||||
Key string `json:"key" validate:"required"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AgentSettingUpdate struct {
|
|
||||||
Key string `json:"key" validate:"required,oneof=SystemIP DockerSockPath FileRecycleBin"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SyncTime struct {
|
|
||||||
NtpSite string `json:"ntpSite" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CleanData struct {
|
|
||||||
SystemClean []CleanTree `json:"systemClean"`
|
|
||||||
BackupClean []CleanTree `json:"backupClean"`
|
|
||||||
UploadClean []CleanTree `json:"uploadClean"`
|
|
||||||
DownloadClean []CleanTree `json:"downloadClean"`
|
|
||||||
SystemLogClean []CleanTree `json:"systemLogClean"`
|
|
||||||
ContainerClean []CleanTree `json:"containerClean"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CleanTree struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
Children []CleanTree `json:"children"`
|
|
||||||
|
|
||||||
Type string `json:"type"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
|
|
||||||
Size uint64 `json:"size"`
|
|
||||||
IsCheck bool `json:"isCheck"`
|
|
||||||
IsRecommend bool `json:"isRecommend"`
|
|
||||||
CanDelete bool `json:"canDelete"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Clean struct {
|
|
||||||
TreeType string `json:"treeType"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Size uint64 `json:"size"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHDefaultConn struct {
|
|
||||||
WithReset bool `json:"withReset"`
|
|
||||||
DefaultConn string `json:"defaultConn"`
|
|
||||||
}
|
|
||||||
type SSHConnData struct {
|
|
||||||
Addr string `json:"addr" validate:"required"`
|
|
||||||
Port uint `json:"port" validate:"required,number,max=65535,min=1"`
|
|
||||||
User string `json:"user" validate:"required"`
|
|
||||||
AuthMode string `json:"authMode" validate:"oneof=password key"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
PrivateKey string `json:"privateKey"`
|
|
||||||
PassPhrase string `json:"passPhrase"`
|
|
||||||
|
|
||||||
LocalSSHConnShow string `json:"localSSHConnShow"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SystemProxy struct {
|
|
||||||
Type string `json:"type"`
|
|
||||||
URL string `json:"url"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
User string `json:"user"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TerminalAIInfo struct {
|
|
||||||
AIStatus string `json:"aiStatus"`
|
|
||||||
AIAccountID string `json:"aiAccountId"`
|
|
||||||
AIPrefix string `json:"aiPrefix" validate:"required,oneof=@ai #ai /ai"`
|
|
||||||
AIRiskCommands string `json:"aiRiskCommands"`
|
|
||||||
AIRiskCommandsDefault string `json:"aiRiskCommandsDefault"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileManageAIInfo struct {
|
|
||||||
AIStatus string `json:"aiStatus"`
|
|
||||||
AIAccountID string `json:"aiAccountId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type PageSnapshot struct {
|
|
||||||
PageInfo
|
|
||||||
Info string `json:"info"`
|
|
||||||
OrderBy string `json:"orderBy" validate:"required,oneof=name createdAt"`
|
|
||||||
Order string `json:"order" validate:"required,oneof=null ascending descending"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotCreate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
SourceAccountIDs string `json:"sourceAccountIDs" validate:"required"`
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID" validate:"required"`
|
|
||||||
Description string `json:"description" validate:"max=256"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
InterruptStep string `json:"interruptStep"`
|
|
||||||
Timeout uint `json:"timeout"`
|
|
||||||
|
|
||||||
AppData []DataTree `json:"appData"`
|
|
||||||
BackupData []DataTree `json:"backupData"`
|
|
||||||
PanelData []DataTree `json:"panelData"`
|
|
||||||
|
|
||||||
WithDockerConf bool `json:"withDockerConf"`
|
|
||||||
WithMonitorData bool `json:"withMonitorData"`
|
|
||||||
WithLoginLog bool `json:"withLoginLog"`
|
|
||||||
WithOperationLog bool `json:"withOperationLog"`
|
|
||||||
WithSystemLog bool `json:"withSystemLog"`
|
|
||||||
WithTaskLog bool `json:"withTaskLog"`
|
|
||||||
|
|
||||||
IgnoreFiles []string `json:"ignoreFiles"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotData struct {
|
|
||||||
AppData []DataTree `json:"appData"`
|
|
||||||
BackupData []DataTree `json:"backupData"`
|
|
||||||
PanelData []DataTree `json:"panelData"`
|
|
||||||
|
|
||||||
WithDockerConf bool `json:"withDockerConf"`
|
|
||||||
WithMonitorData bool `json:"withMonitorData"`
|
|
||||||
WithLoginLog bool `json:"withLoginLog"`
|
|
||||||
WithOperationLog bool `json:"withOperationLog"`
|
|
||||||
WithSystemLog bool `json:"withSystemLog"`
|
|
||||||
WithTaskLog bool `json:"withTaskLog"`
|
|
||||||
IgnoreFiles []string `json:"ignoreFiles"`
|
|
||||||
}
|
|
||||||
type DataTree struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Label string `json:"label"`
|
|
||||||
Key string `json:"key"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
IsLocal bool `json:"isLocal"`
|
|
||||||
Size uint64 `json:"size"`
|
|
||||||
IsCheck bool `json:"isCheck"`
|
|
||||||
IsDisable bool `json:"isDisable"`
|
|
||||||
|
|
||||||
Path string `json:"path"`
|
|
||||||
|
|
||||||
RelationItemID string `json:"relationItemID"`
|
|
||||||
Children []DataTree `json:"children"`
|
|
||||||
}
|
|
||||||
type SnapshotRecover struct {
|
|
||||||
IsNew bool `json:"isNew"`
|
|
||||||
ReDownload bool `json:"reDownload"`
|
|
||||||
ID uint `json:"id" validate:"required"`
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
}
|
|
||||||
type SnapshotBatchDelete struct {
|
|
||||||
DeleteWithFile bool `json:"deleteWithFile"`
|
|
||||||
Ids []uint `json:"ids" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotImport struct {
|
|
||||||
BackupAccountID uint `json:"backupAccountID"`
|
|
||||||
Names []string `json:"names"`
|
|
||||||
Description string `json:"description" validate:"max=256"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SnapshotInfo struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Description string `json:"description" validate:"max=256"`
|
|
||||||
SourceAccounts []string `json:"sourceAccounts"`
|
|
||||||
DownloadAccount string `json:"downloadAccount"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
Size int64 `json:"size"`
|
|
||||||
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
TaskRecoverID string `json:"taskRecoverID"`
|
|
||||||
TaskRollbackID string `json:"taskRollbackID"`
|
|
||||||
|
|
||||||
InterruptStep string `json:"interruptStep"`
|
|
||||||
RecoverStatus string `json:"recoverStatus"`
|
|
||||||
RecoverMessage string `json:"recoverMessage"`
|
|
||||||
LastRecoveredAt string `json:"lastRecoveredAt"`
|
|
||||||
RollbackStatus string `json:"rollbackStatus"`
|
|
||||||
RollbackMessage string `json:"rollbackMessage"`
|
|
||||||
LastRollbackedAt string `json:"lastRollbackedAt"`
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
type SSHUpdate struct {
|
|
||||||
Key string `json:"key" validate:"required"`
|
|
||||||
NewValue string `json:"newValue"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHInfo struct {
|
|
||||||
AutoStart bool `json:"autoStart"`
|
|
||||||
IsExist bool `json:"isExist"`
|
|
||||||
IsActive bool `json:"isActive"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
ListenAddress string `json:"listenAddress"`
|
|
||||||
PasswordAuthentication string `json:"passwordAuthentication"`
|
|
||||||
PubkeyAuthentication string `json:"pubkeyAuthentication"`
|
|
||||||
PermitRootLogin string `json:"permitRootLogin"`
|
|
||||||
UseDNS string `json:"useDNS"`
|
|
||||||
CurrentUser string `json:"currentUser"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type RootCertOperate struct {
|
|
||||||
ID uint `json:"id"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
EncryptionMode string `json:"encryptionMode"`
|
|
||||||
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 {
|
|
||||||
EncryptionMode string `json:"encryptionMode" validate:"required,oneof=rsa ed25519 ecdsa dsa"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHConf struct {
|
|
||||||
File string `json:"file"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHConfUpdate struct {
|
|
||||||
Key string `json:"key" validate:"required"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
type SearchSSHLog struct {
|
|
||||||
PageInfo
|
|
||||||
Info string `json:"info"`
|
|
||||||
Status string `json:"Status" validate:"required,oneof=Success Failed All"`
|
|
||||||
StartTime time.Time `json:"startTime"`
|
|
||||||
EndTime time.Time `json:"endTime"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type SSHHistory struct {
|
|
||||||
Date time.Time `json:"date"`
|
|
||||||
DateStr string `json:"dateStr"`
|
|
||||||
Area string `json:"area"`
|
|
||||||
User string `json:"user"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
Address string `json:"address"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package dto
|
|
||||||
|
|
||||||
type TerminalSessionClose struct {
|
|
||||||
ID string `json:"id" validate:"required"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type TerminalSessionRevoke struct {
|
|
||||||
Scope string `json:"scope" validate:"required,oneof=auth_session user all"`
|
|
||||||
UserID string `json:"userId"`
|
|
||||||
AuthSessionID string `json:"authSessionId"`
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type Agent struct {
|
|
||||||
BaseModel
|
|
||||||
Name string `json:"name" gorm:"not null;unique"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
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"`
|
|
||||||
WebsiteID uint `json:"websiteId"`
|
|
||||||
AccountID uint `json:"accountId"`
|
|
||||||
ConfigPath string `json:"configPath"`
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AgentAccount struct {
|
|
||||||
BaseModel
|
|
||||||
Provider string `json:"provider"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
APIKey string `json:"apiKey"`
|
|
||||||
BaseURL string `json:"baseUrl"`
|
|
||||||
APIType string `json:"apiType"`
|
|
||||||
AuthMode string `json:"authMode"`
|
|
||||||
VerifyModel string `json:"verifyModel"`
|
|
||||||
RememberAPIKey bool `json:"rememberApiKey"`
|
|
||||||
Verified bool `json:"verified"`
|
|
||||||
Remark string `json:"remark"`
|
|
||||||
MasterAccountID uint `json:"masterAccountId" gorm:"index"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (AgentAccount) TableName() string {
|
|
||||||
return "agent_provider_accounts"
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AgentAccountModel struct {
|
|
||||||
BaseModel
|
|
||||||
AccountID uint `json:"accountId" gorm:"index"`
|
|
||||||
Model string `json:"model" gorm:"index"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
SortOrder int `json:"sortOrder" gorm:"index"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (AgentAccountModel) TableName() string {
|
|
||||||
return "agent_account_models"
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
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:text;not null" json:"method"`
|
|
||||||
SendCount uint `gorm:"type:integer" json:"sendCount"`
|
|
||||||
AdvancedParams string `gorm:"type:longText" json:"advancedParams"`
|
|
||||||
CreateUser string `gorm:"type:varchar(256)" json:"createUser"`
|
|
||||||
UpdateUser string `gorm:"type:varchar(256)" json:"updateUser"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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(128);not null;default:'sms'" json:"method"`
|
|
||||||
DeliveryLogID *uint `gorm:"uniqueIndex" json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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(128);not null;default:'sms'" json:"method"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type AlertConfig struct {
|
|
||||||
BaseModel
|
|
||||||
UID string `gorm:"type:varchar(64);not null;uniqueIndex" json:"uid"`
|
|
||||||
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:text;not null" json:"config"`
|
|
||||||
SecretConfig string `gorm:"type:text;not null;default:''" json:"-"`
|
|
||||||
CreateUser string `gorm:"type:varchar(256)" json:"createUser"`
|
|
||||||
UpdateUser string `gorm:"type:varchar(256)" json:"updateUser"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *AlertConfig) BeforeCreate(_ *gorm.DB) error {
|
|
||||||
if strings.TrimSpace(a.UID) == "" {
|
|
||||||
a.UID = uuid.NewString()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type LoginLog struct {
|
|
||||||
BaseModel
|
|
||||||
IP string `json:"ip"`
|
|
||||||
Address string `json:"address"`
|
|
||||||
Agent string `json:"agent"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/constant"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
)
|
|
||||||
|
|
||||||
type App struct {
|
|
||||||
BaseModel
|
|
||||||
Name string `json:"name" gorm:"not null"`
|
|
||||||
Key string `json:"key" gorm:"not null;"`
|
|
||||||
ShortDescZh string `json:"shortDescZh" yaml:"shortDescZh"`
|
|
||||||
ShortDescEn string `json:"shortDescEn" yaml:"shortDescEn"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Icon string `json:"icon"`
|
|
||||||
Type string `json:"type" gorm:"not null"`
|
|
||||||
Status string `json:"status" gorm:"not null"`
|
|
||||||
Required string `json:"required"`
|
|
||||||
CrossVersionUpdate bool `json:"crossVersionUpdate" yaml:"crossVersionUpdate"`
|
|
||||||
Limit int `json:"limit" gorm:"not null"`
|
|
||||||
Website string `json:"website" gorm:"not null"`
|
|
||||||
Github string `json:"github" gorm:"not null"`
|
|
||||||
Document string `json:"document" gorm:"not null"`
|
|
||||||
Recommend int `json:"recommend" gorm:"not null"`
|
|
||||||
Resource string `json:"resource" gorm:"not null;default:remote"`
|
|
||||||
ReadMe string `json:"readMe"`
|
|
||||||
LastModified int `json:"lastModified"`
|
|
||||||
Architectures string `json:"architectures"`
|
|
||||||
MemoryRequired int `json:"memoryRequired"`
|
|
||||||
GpuSupport bool `json:"gpuSupport"`
|
|
||||||
RequiredPanelVersion float64 `json:"requiredPanelVersion"`
|
|
||||||
BatchInstallSupport bool `json:"batchInstallSupport" yaml:"batchInstallSupport"`
|
|
||||||
|
|
||||||
Details []AppDetail `json:"-" gorm:"-:migration"`
|
|
||||||
TagsKey []string `json:"tags" yaml:"tags" gorm:"-"`
|
|
||||||
AppTags []AppTag `json:"-" gorm:"-:migration"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *App) IsLocalApp() bool {
|
|
||||||
return i.Resource == constant.ResourceLocal
|
|
||||||
}
|
|
||||||
func (i *App) IsCustomApp() bool {
|
|
||||||
return i.Resource == constant.AppResourceCustom
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *App) GetAppResourcePath() string {
|
|
||||||
if i.IsLocalApp() {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLang(c *gin.Context) string {
|
|
||||||
lang := c.GetHeader("Accept-Language")
|
|
||||||
if lang == "" {
|
|
||||||
lang = "en"
|
|
||||||
}
|
|
||||||
return lang
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *App) GetDescription(ctx *gin.Context) string {
|
|
||||||
var translations = make(map[string]string)
|
|
||||||
_ = json.Unmarshal([]byte(i.Description), &translations)
|
|
||||||
lang := strings.ToLower(getLang(ctx))
|
|
||||||
if desc, ok := translations[lang]; ok && desc != "" {
|
|
||||||
return desc
|
|
||||||
}
|
|
||||||
if lang == "zh" && i.ShortDescZh != "" {
|
|
||||||
return i.ShortDescZh
|
|
||||||
}
|
|
||||||
if desc, ok := translations["en"]; ok && desc != "" {
|
|
||||||
return desc
|
|
||||||
}
|
|
||||||
return i.ShortDescEn
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AppDetail struct {
|
|
||||||
BaseModel
|
|
||||||
AppId uint `json:"appId" gorm:"not null"`
|
|
||||||
Version string `json:"version" gorm:"not null"`
|
|
||||||
Params string `json:"-"`
|
|
||||||
DockerCompose string `json:"dockerCompose"`
|
|
||||||
Status string `json:"status" gorm:"not null"`
|
|
||||||
LastVersion string `json:"lastVersion"`
|
|
||||||
LastModified int `json:"lastModified"`
|
|
||||||
DownloadUrl string `json:"downloadUrl"`
|
|
||||||
DownloadCallBackUrl string `json:"downloadCallBackUrl"`
|
|
||||||
Update bool `json:"update"`
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AppIgnoreUpgrade struct {
|
|
||||||
BaseModel
|
|
||||||
AppID uint `json:"appID"`
|
|
||||||
AppDetailID uint `json:"appDetailID"`
|
|
||||||
Scope string `json:"scope"`
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/constant"
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/global"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AppInstall struct {
|
|
||||||
BaseModel
|
|
||||||
Name string `json:"name" gorm:"not null;UNIQUE"`
|
|
||||||
AppId uint `json:"appId" gorm:"not null"`
|
|
||||||
AppDetailId uint `json:"appDetailId" gorm:"not null"`
|
|
||||||
Version string `json:"version" gorm:"not null"`
|
|
||||||
Param string `json:"param"`
|
|
||||||
Env string `json:"env"`
|
|
||||||
DockerCompose string `json:"dockerCompose" `
|
|
||||||
Status string `json:"status" gorm:"not null"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
ContainerName string `json:"containerName" gorm:"not null"`
|
|
||||||
ServiceName string `json:"serviceName" gorm:"not null"`
|
|
||||||
HttpPort int `json:"httpPort"`
|
|
||||||
HttpsPort int `json:"httpsPort"`
|
|
||||||
WebUI string `json:"webUI"`
|
|
||||||
Favorite bool `json:"favorite"`
|
|
||||||
SortOrder int `json:"sortOrder" gorm:"default:0"`
|
|
||||||
|
|
||||||
App App `json:"app" gorm:"-:migration"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *AppInstall) GetPath() string {
|
|
||||||
return path.Join(i.GetAppPath(), i.Name)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *AppInstall) GetComposePath() string {
|
|
||||||
return path.Join(i.GetAppPath(), i.Name, "docker-compose.yml")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *AppInstall) GetEnvPath() string {
|
|
||||||
return path.Join(i.GetAppPath(), i.Name, ".env")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *AppInstall) GetAppPath() string {
|
|
||||||
if i.App.Resource == constant.AppResourceLocal {
|
|
||||||
return path.Join(global.Dir.LocalAppInstallDir, strings.TrimPrefix(i.App.Key, constant.AppResourceLocal))
|
|
||||||
} else {
|
|
||||||
return path.Join(global.Dir.AppInstallDir, i.App.Key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AppInstallResource struct {
|
|
||||||
BaseModel
|
|
||||||
AppInstallId uint `json:"appInstallId" gorm:"not null;"`
|
|
||||||
LinkId uint `json:"linkId" gorm:"not null;"`
|
|
||||||
ResourceId uint `json:"resourceId"`
|
|
||||||
Key string `json:"key" gorm:"not null"`
|
|
||||||
From string `json:"from" gorm:"not null;default:local"`
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AppLauncher struct {
|
|
||||||
BaseModel
|
|
||||||
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"`
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type AppTag struct {
|
|
||||||
BaseModel
|
|
||||||
AppId uint `json:"appId" gorm:"not null"`
|
|
||||||
TagId uint `json:"tagId" gorm:"not null"`
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
type BackupAccount struct {
|
|
||||||
BaseModel
|
|
||||||
Name string `gorm:"not null;default:''" json:"name"`
|
|
||||||
Type string `gorm:"not null;default:''" json:"type"`
|
|
||||||
IsPublic bool `json:"isPublic"`
|
|
||||||
Bucket string `json:"bucket"`
|
|
||||||
AccessKey string `json:"accessKey"`
|
|
||||||
Credential string `json:"credential"`
|
|
||||||
BackupPath string `json:"backupPath"`
|
|
||||||
Vars string `json:"vars"`
|
|
||||||
|
|
||||||
RememberAuth bool `json:"rememberAuth"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type BackupRecord struct {
|
|
||||||
BaseModel
|
|
||||||
From string `json:"from"`
|
|
||||||
CronjobID uint `json:"cronjobID"`
|
|
||||||
SourceAccountIDs string `json:"sourceAccountIDs"`
|
|
||||||
DownloadAccountID uint `json:"downloadAccountID"`
|
|
||||||
|
|
||||||
Type string `gorm:"not null;default:''" json:"type"`
|
|
||||||
Name string `gorm:"not null;default:''" json:"name"`
|
|
||||||
DetailName string `json:"detailName"`
|
|
||||||
FileDir string `json:"fileDir"`
|
|
||||||
FileName string `json:"fileName"`
|
|
||||||
|
|
||||||
TaskID string `json:"taskID"`
|
|
||||||
Status string `json:"status"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Args string `gorm:"not null;default:''" json:"args"`
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user