mirror of
https://github.com/tnb-labs/panel.git
synced 2026-08-31 01:12:17 +08:00
Compare commits
1133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 38935607d6 | |||
| 0af6b22862 | |||
| 787bb80355 | |||
| 1785b8ee1a | |||
| a223280172 | |||
| e1cceca340 | |||
| b9d5aa5fb1 | |||
| 3fae54bf58 | |||
| 1b2f9ea1d2 | |||
| fb94c015b2 | |||
| 1ae8011660 | |||
| 2978df4981 | |||
| 99cd473680 | |||
| d18bf93571 | |||
| 86e4cff989 | |||
| 6072332e1a | |||
| 8721cff4df | |||
| cab338c4c4 | |||
| de7dd8834f | |||
| 1d9e2761f3 | |||
| 6102742377 | |||
| 641747230b | |||
| 3c1c4e92b9 | |||
| 6ec5ebb18d | |||
| 198bd39664 | |||
| b561e241a5 | |||
| ff3b755faa | |||
| 7e7b180370 | |||
| 497e357d65 | |||
| 09698f7cd3 | |||
| 119183971d | |||
| 96d7e14631 | |||
| 0c4d97a512 | |||
| 3c39027120 | |||
| 8f6b2647a3 | |||
| ecbf8dd51a | |||
| 8a8e6302da | |||
| 2e45b6c5ab | |||
| 962098b1f7 | |||
| 7817756569 | |||
| 6738f3e83d | |||
| 07bb0961da | |||
| ac6c57b394 | |||
| 5082a4f9f9 | |||
| cfc1d46381 | |||
| 3157011cc0 | |||
| 48b06b25da | |||
| f04ae48347 | |||
| 87d26fbb23 | |||
| 6cfb7f4e0b | |||
| bee61facad | |||
| 342bf62ef6 | |||
| 9cd80f8d1b | |||
| f9b53175a1 | |||
| 6704612482 | |||
| d31f40f2dc | |||
| e02de8ba05 | |||
| 95f0e0d536 | |||
| 7e18d75203 | |||
| 3de66d884c | |||
| a911002953 | |||
| c5d0b31251 | |||
| f77e4d17fc | |||
| 6892cff96f | |||
| 4337bc2718 | |||
| 82145021b7 | |||
| d0d98f273c | |||
| 7ff18ae0a9 | |||
| 7a5d2352fa | |||
| dc0314fc28 | |||
| 9ca2445d4a | |||
| ba42e33b72 | |||
| 06c0c08ead | |||
| dc96f9d4ac | |||
| e7a54cbe85 | |||
| 39f03106df | |||
| 24ec5d0bb3 | |||
| 22cd9f8ce1 | |||
| c5efc2fb33 | |||
| 24b633d24c | |||
| 6f994e2282 | |||
| 946a8198a3 | |||
| 39ff8c9040 | |||
| 65ebecafdb | |||
| af5e79ce37 | |||
| a37393b688 | |||
| c18a96e439 | |||
| 1208144605 | |||
| 07c1c110d9 | |||
| dd66274997 | |||
| dc0174c64e | |||
| 67055a5aac | |||
| 54470f87b0 | |||
| 41a61a2c15 | |||
| 17390a026f | |||
| 3fce818d13 | |||
| 169c0ff18e | |||
| 6a30d56d7d | |||
| 4ad7ec58be | |||
| d4feba17d0 | |||
| e5f36df4bf | |||
| e1b53e88ec | |||
| d12aabd4d3 | |||
| 54c893d6e6 | |||
| 4e01168f3c | |||
| 5bb43dbf0f | |||
| dcb0d667ea | |||
| af8ef1abc8 | |||
| 2fc19dd97e | |||
| b0e577b42a | |||
| 051b6b9227 | |||
| 92ac563d75 | |||
| b7b775971e | |||
| 32266ca7c8 | |||
| 73387d114e | |||
| 3271557561 | |||
| 9a295241c3 | |||
| a00b44c485 | |||
| 93b72ad45f | |||
| a86b35f587 | |||
| 4054c788f3 | |||
| 881eb7bfb1 | |||
| fcc35c19ee | |||
| 7c3b5c02ba | |||
| bb70b25565 | |||
| bc2e07bcd8 | |||
| aa74f30893 | |||
| 27687d7dbf | |||
| f6f21d7b70 | |||
| 0815507aa8 | |||
| fb40b140c9 | |||
| eedf07ec2a | |||
| 5c214625c3 | |||
| 0402805f24 | |||
| 40715dd8a3 | |||
| 505e6d4794 | |||
| 04f3925e6d | |||
| c77fa3f0ea | |||
| 51ede84e0a | |||
| 053ef46f95 | |||
| 11d58d838f | |||
| 13b15ccb32 | |||
| 255acb392c | |||
| 6c16901dbc | |||
| 284a4c67d4 | |||
| 484ad397e7 | |||
| 407203dcfa | |||
| dded5e26aa | |||
| d029e6c58e | |||
| c1c0cbbac5 | |||
| 0fffe3a644 | |||
| 2e26af435a | |||
| ef2ecfcc80 | |||
| 6fe4d82619 | |||
| 29562974ce | |||
| b7f169634b | |||
| 87e3011f18 | |||
| cc714a5007 | |||
| 615744e0cf | |||
| 3193a15131 | |||
| 194287554e | |||
| 97b1d1a4bb | |||
| b150f61862 | |||
| b82bc21d1b | |||
| 6e9a4963af | |||
| b4a3708fa0 | |||
| 9bca8173f2 | |||
| 6520aba081 | |||
| 2903d00550 | |||
| a53ba36db8 | |||
| e9f2854d59 | |||
| 43cd3bf38d | |||
| 325a218e20 | |||
| 847e55bc8b | |||
| 1ebddd289c | |||
| e3f8fe8fe9 | |||
| b9996ba41e | |||
| bb1cd025f1 | |||
| a3059eb1cb | |||
| 192a1044ed | |||
| bbc6e3c7cc | |||
| 0aaea53af6 | |||
| 2ad9f48a5b | |||
| 0e715a7576 | |||
| 724610a45d | |||
| f65cf9e38e | |||
| 4a8ebfbdfa | |||
| fee0fcb998 | |||
| 1e081fcdf2 | |||
| 6c6fb09270 | |||
| 51b47818c0 | |||
| 5b393819ba | |||
| f807d0cd1a | |||
| 0d6f0f317d | |||
| 6bad7f4b5b | |||
| 7a7134b26a | |||
| 28cf7098ff | |||
| b56979147e | |||
| 2ec0d9e844 | |||
| 66641a626e | |||
| 95bfd6843b | |||
| 7e28a34b7f | |||
| b2152edeeb | |||
| 00815979d2 | |||
| c4e01b37b7 | |||
| 7907345521 | |||
| 8f32d6cdb0 | |||
| c3582903bf | |||
| 7d25d2f5aa | |||
| 46fc7b1c6a | |||
| 34ac62d1ae | |||
| 30e78ccf46 | |||
| 22f4cc7fcb | |||
| 1771ae682d | |||
| d1beb60ffd | |||
| cba5f86667 | |||
| e1d9832ce0 | |||
| 6278535902 | |||
| 32fb87243b | |||
| 5f85e7fbe0 | |||
| c36104a075 | |||
| 583f5d13c7 | |||
| b453738daf | |||
| 98431fb4b2 | |||
| 4d76e9286d | |||
| c70758339f | |||
| ff524cdb0b | |||
| 73c95d880a | |||
| 8a1d8c0b05 | |||
| 2251175906 | |||
| 69edde98c8 | |||
| 29a3db640d | |||
| ee87bf65b4 | |||
| aa080dab15 | |||
| b4e5498b48 | |||
| 63838bffa1 | |||
| fa41b18ced | |||
| 31bd15217b | |||
| e6b6f06706 | |||
| 1b836297bf | |||
| 96bea2cf90 | |||
| 8aff513284 | |||
| 368e41a512 | |||
| 924fdee7c5 | |||
| 438ba1db1e | |||
| d4e52a2d87 | |||
| 4432a12c7a | |||
| a75e36e447 | |||
| 05674ee04e | |||
| 09703761eb | |||
| dfa14c3fd4 | |||
| 7b80f034ea | |||
| 71923093fd | |||
| aae3cf0518 | |||
| ed22e79552 | |||
| 15dd5bb718 | |||
| 0e7af2914e | |||
| 7ec378829b | |||
| f2e8ff86c6 | |||
| eed03d644f | |||
| d9be877710 | |||
| 10439d7d97 | |||
| 55eaa26970 | |||
| 0d769d3400 | |||
| 7ff084e5a8 | |||
| 89e133c626 | |||
| c876f4c484 | |||
| 85c38e5bc5 | |||
| 6bd07251fc | |||
| 11d6b40dce | |||
| aa9b55d1eb | |||
| 2e97812776 | |||
| e0a7ada6d5 | |||
| d48963ab50 | |||
| 59bfed66dc | |||
| 5c0bc8a1b7 | |||
| ae9e39d0fe | |||
| 49b72aa656 | |||
| e0f642cbff | |||
| eb2c6cab81 | |||
| 0a3d3828c8 | |||
| 46b431de30 | |||
| 8a5b46ad7e | |||
| 5bd14946de | |||
| f6c091c725 | |||
| f4dc94ad9a | |||
| 8bcc0c0c05 | |||
| 0be04e1859 | |||
| bec9336f2f | |||
| 0be4ce9891 | |||
| 634a9a3219 | |||
| 1f2a32f883 | |||
| 32a56aa2dc | |||
| 8185a69354 | |||
| d41862f63b | |||
| 20e5122425 | |||
| 17bb8ad62b | |||
| 43624de2e4 | |||
| cc6a45b127 | |||
| 7a4a71f0a0 | |||
| 27cbb92a06 | |||
| 5ddbdfc5df | |||
| b3b1b0971f | |||
| 9caad365e9 | |||
| 5b54232e16 | |||
| a510bdb05d | |||
| 50a8b16832 | |||
| 2f56241da1 | |||
| 8557259b53 | |||
| 1d7ea0280a | |||
| 10145da2f9 | |||
| 6ba7d01875 | |||
| 763fa7379d | |||
| a36eaf7e9a | |||
| ec10cd30a5 | |||
| 847fae5caa | |||
| b3b8c22634 | |||
| 5f504d49ef | |||
| 44045da4eb | |||
| baf90c0602 | |||
| f7e67c3797 | |||
| d7a79fa53e | |||
| b9b3b9fedf | |||
| e27940a71b | |||
| aa22933b36 | |||
| a1dceaaa82 | |||
| ebd5d37e78 | |||
| 107d2ec658 | |||
| 3a70d80bb5 | |||
| 7c58d8dcce | |||
| bde93b488c | |||
| 77aa4bea34 | |||
| 18de16047d | |||
| f7ba602a50 | |||
| 3101486a44 | |||
| b51a8e1d03 | |||
| 83f58e0a2e | |||
| e941ab6661 | |||
| 688801eebb | |||
| 8ad42f8c0e | |||
| 02c8809785 | |||
| fd0e43fb26 | |||
| 96ec795096 | |||
| 5ea191b550 | |||
| c37cc3bd2c | |||
| 110f305f16 | |||
| 179b6ff83e | |||
| 0da1b0b565 | |||
| 0da3f7b8e0 | |||
| c6f9a585b0 | |||
| 686bdd9ae2 | |||
| e3a22f924e | |||
| 0c3c47361b | |||
| c3f9f56f11 | |||
| 76e992cc9e | |||
| 73cc5a35ad | |||
| 873520e9f4 | |||
| af3254c11a | |||
| 5575d34ab4 | |||
| a995c56f1b | |||
| 1fbea148e3 | |||
| ca504e1acc | |||
| 18fe84117d | |||
| 9eb9a2c7d6 | |||
| de7d50ce51 | |||
| 6e0d93257f | |||
| 96806d4e94 | |||
| 3de78c95bf | |||
| 367348e688 | |||
| 07dfcd778c | |||
| 789d5e7ddd | |||
| 1102aba9a3 | |||
| fddb076136 | |||
| b1ff8fff3d | |||
| 5cd68fcdc3 | |||
| 3a5ff9179a | |||
| fa7c54ada5 | |||
| 94047174d1 | |||
| 305777f65a | |||
| d56d3ec1dd | |||
| 8ac8da7914 | |||
| 5d56663b69 | |||
| 7ff574cb92 | |||
| 00b4153a28 | |||
| 9412b31279 | |||
| bbf04c91cf | |||
| 252456a1cd | |||
| 8de68b317d | |||
| 8bf273e1fd | |||
| 32111ecd7a | |||
| 82b8a32133 | |||
| b82c644d81 | |||
| 06bf1b0604 | |||
| 7b29e4546a | |||
| ae6b354a78 | |||
| d96c616c61 | |||
| 213698dd2a | |||
| 39b3c74684 | |||
| b3a1af1001 | |||
| 91b244276a | |||
| b1eefd062d | |||
| 2edf6748e7 | |||
| eac69b8dab | |||
| bb7b641193 | |||
| 3b0aee1967 | |||
| 2ae7f3e458 | |||
| ee0442d159 | |||
| 363b7a55be | |||
| 3437bb2b1f | |||
| 7e000cddc8 | |||
| a18652f134 | |||
| dcd8bb3dd9 | |||
| d62a280fe9 | |||
| c3a7710e6f | |||
| 7f1491f739 | |||
| c96b88548e | |||
| f62b112e1b | |||
| e55e3402e9 | |||
| 48b539b31a | |||
| d35245aa11 | |||
| 7f46dea052 | |||
| 48ed174dc6 | |||
| a5743f94b2 | |||
| 227c5344e3 | |||
| 4c8a88ea03 | |||
| 3503aac2f6 | |||
| 6beda2ea12 | |||
| 4579bf8fa9 | |||
| 002db34b4d | |||
| e276c4f747 | |||
| f5e6219ca4 | |||
| fd92b1d360 | |||
| 5b8289c0b0 | |||
| d8fe050607 | |||
| c0310d916f | |||
| 77ed2d77e1 | |||
| c331143e9e | |||
| 71e75312ff | |||
| 0e5bee4852 | |||
| 036ad9222a | |||
| 39cd5545c5 | |||
| 4568e60133 | |||
| d2f224eaa6 | |||
| c77713b3d9 | |||
| f1e2ba5c35 | |||
| 243a36f41c | |||
| 74f772b705 | |||
| e8f1ed5dec | |||
| 634d8c643b | |||
| 1829b46466 | |||
| 478efa5016 | |||
| 841e0e351f | |||
| 0e9761f975 | |||
| 5c067e28b7 | |||
| 0a0e0bcac1 | |||
| c3732b904d | |||
| 161370ac5a | |||
| 0cfe585ad5 | |||
| 283d9dbe26 | |||
| 45ed3f2ff9 | |||
| 5703e3354f | |||
| da2e66b7c6 | |||
| 8dca4c1cbf | |||
| a295eb9a65 | |||
| 868ee73d51 | |||
| ef7d38f2af | |||
| 801ff28854 | |||
| e0a401f688 | |||
| f50f2f7f2b | |||
| 3df1388326 | |||
| 5390ef3140 | |||
| 7cb5a3db4b | |||
| 082b0d2755 | |||
| 10ba87b63a | |||
| ec4c187a11 | |||
| 2e250dbb39 | |||
| 69938cf9bc | |||
| 3bc3efe59c | |||
| 9b6c9484e4 | |||
| e127572300 | |||
| c757dd9555 | |||
| 97c3f4c7c7 | |||
| 1e8c4945d5 | |||
| 90ef29acc4 | |||
| 89a6c3733b | |||
| 26d8aacabd | |||
| e7e5d4b283 | |||
| db0e722ea3 | |||
| ccd0aa3505 | |||
| 43f19c802f | |||
| a86d8a7490 | |||
| 08d906e27c | |||
| 70d65b2b2c | |||
| 3de92c9603 | |||
| deb9d9fbd2 | |||
| 71903c1100 | |||
| 9853c1792b | |||
| 18f0257ff2 | |||
| 0754fcaf6a | |||
| ea7bb34be7 | |||
| 383b1652cf | |||
| ca36c7c62a | |||
| c42fc0c70d | |||
| a89f5e3ca3 | |||
| 64537e1c75 | |||
| 19a57f9951 | |||
| 95a90db230 | |||
| 5dcfe4126c | |||
| d3e758f61a | |||
| d921939186 | |||
| b0a5221aed | |||
| dd4db4899d | |||
| 7f0b7b349a | |||
| 2a483bc9cd | |||
| 731a1f13a9 | |||
| 95025267aa | |||
| 4dd1bd3d46 | |||
| 633fa61738 | |||
| 35c998f402 | |||
| 1a82279304 | |||
| ac4380ef14 | |||
| 6b8228a048 | |||
| 67927eef06 | |||
| 429a027c79 | |||
| 284f6fb953 | |||
| 8194028a76 | |||
| c173f57c6d | |||
| 639159f150 | |||
| 89bd5d4b36 | |||
| 165424b4b2 | |||
| d519ede9e9 | |||
| ebe2700cfd | |||
| bf56151db5 | |||
| 53e13d1257 | |||
| 2732a476fd | |||
| e8b7128f7a | |||
| ec9bd0ebb3 | |||
| e1da619460 | |||
| a90b800ede | |||
| d64403f49a | |||
| 527ef39a92 | |||
| 82d2fab895 | |||
| bdf33163f0 | |||
| 705620ab13 | |||
| 6e2d3eed06 | |||
| 053de1b848 | |||
| 721d579512 | |||
| 8b8fbaa3ec | |||
| 4a8a4dbcde | |||
| cd241f88af | |||
| 064bf7e1ed | |||
| c1aa6e2e17 | |||
| 246e53c519 | |||
| 0810eee37a | |||
| c003b11ff3 | |||
| d39743cdb9 | |||
| 94751d474f | |||
| 63033dfa15 | |||
| 8dc41d4222 | |||
| 396fb1207e | |||
| 0ce8b15aca | |||
| 55fc516049 | |||
| a9c19115d4 | |||
| 9375860203 | |||
| 52aaadb2f9 | |||
| c7ad1a1435 | |||
| c0db1cf993 | |||
| bad23197c1 | |||
| f6dc38e61b | |||
| 40ce8a2aad | |||
| 999fda846d | |||
| 958369b5ce | |||
| dc86e2efa3 | |||
| bb23be565a | |||
| 2a40cb11f7 | |||
| 4da6969636 | |||
| bb5dd8a835 | |||
| 7af5ab3c30 | |||
| 6a328c3a42 | |||
| 51ec5e137b | |||
| 8684727267 | |||
| c884dd6fd7 | |||
| 35d2838036 | |||
| 0acf996981 | |||
| 2be12f20f2 | |||
| 07b0c7a010 | |||
| cf4bc94e6d | |||
| d89f9553e9 | |||
| e4536360bd | |||
| 8bfef8030c | |||
| 69e972fa5e | |||
| a33bd8309c | |||
| dacdfc6d45 | |||
| 1c4e34e8fe | |||
| c9f650ff66 | |||
| 255f94d588 | |||
| a3aaaa37ef | |||
| f31e3a7d8e | |||
| 1e462bf0e6 | |||
| 1ed79a86b2 | |||
| 0e4d593d6c | |||
| 849e6602dd | |||
| 4dc16b1e03 | |||
| 599f3b5cb4 | |||
| ccc50ed6ee | |||
| 8e84d2553f | |||
| d731efb082 | |||
| 11ad8e524e | |||
| 87e975df28 | |||
| 00d0cadb03 | |||
| 10db77ffd3 | |||
| 3c82631d7b | |||
| cd27c05d1c | |||
| 3a8f850a50 | |||
| 06e66eaa0a | |||
| 2fcd3db4a4 | |||
| 2ec74e774b | |||
| b26f75f3a3 | |||
| 7e685dd43c | |||
| 3d3dcbef8d | |||
| bc2166ee66 | |||
| 7cf577ff5b | |||
| 87cdda782e | |||
| 24106288cb | |||
| 3f258a5f81 | |||
| ce8addfecd | |||
| d969360b54 | |||
| 1f43a12f81 | |||
| 930b86a671 | |||
| 790e56003e | |||
| c38736abb6 | |||
| befad1d3ac | |||
| 53d8c2ff6d | |||
| d07314b5be | |||
| f04cafbcee | |||
| 86199b9eec | |||
| e4e3ad5821 | |||
| a80ddfaebc | |||
| 026e1319fe | |||
| b532064cf0 | |||
| f900ada2c6 | |||
| 468b20348a | |||
| 862686e4e2 | |||
| 5a3a1e694b | |||
| a368117e00 | |||
| 596cd68728 | |||
| d55bb5ffe1 | |||
| 94ff9e2dbc | |||
| f4cb1a850a | |||
| 7d1acae966 | |||
| 18b524bddc | |||
| 70596a7906 | |||
| fbf0b7acce | |||
| 12ad6e8879 | |||
| b4ea470099 | |||
| bb9f629b8e | |||
| fb099b1124 | |||
| 8584f0809e | |||
| 8ae3751f0b | |||
| 0e0fbb9a93 | |||
| 7349e027e2 | |||
| b5ba1018fa | |||
| b1479b9051 | |||
| 3a9b2ab10a | |||
| f61f1fa213 | |||
| 73c0f41e3d | |||
| 361199ddb5 | |||
| a86badc64d | |||
| 154e0afbc3 | |||
| 58a13f0636 | |||
| 4ab4f273e7 | |||
| 5e7859f063 | |||
| 50662ecfa1 | |||
| 007bbb0ce4 | |||
| 6b36e1659c | |||
| 4b4c2c4a0b | |||
| fc9ca25a46 | |||
| ff60fb44b7 | |||
| 37f677bca3 | |||
| a9000f851c | |||
| 437b88eaf2 | |||
| 12563e0cd2 | |||
| f7d65fc22e | |||
| 83cbae034c | |||
| 2b1b58ea2b | |||
| 1c5b32a7a9 | |||
| edd526d3b8 | |||
| 4c41ec036c | |||
| ac420debbb | |||
| 46e027b18c | |||
| fe98a5be1b | |||
| 63c4e27806 | |||
| b769032990 | |||
| e56fcac3b8 | |||
| b0a6405b8e | |||
| 43f12873c0 | |||
| 89004f4d04 | |||
| b0c072f78b | |||
| 8559fb9d0c | |||
| 1bbec2b637 | |||
| 1426fb48ff | |||
| 0509397332 | |||
| 57de4cb988 | |||
| d05d3eb2aa | |||
| 876fdc419f | |||
| 3f64d81250 | |||
| c4d304f2c9 | |||
| 33d5d48b59 | |||
| d90423db4a | |||
| e032faeae0 | |||
| 70601dfb00 | |||
| c6263ebe73 | |||
| 485b7b9e8d | |||
| 4c4a605684 | |||
| a347b5470d | |||
| 0a3573bfb7 | |||
| 01620ebd1d | |||
| 57ad59093d | |||
| 4339ad7c50 | |||
| 5916ad98bd | |||
| b8ccfbb4f5 | |||
| 786985341b | |||
| 1cb5a61ff2 | |||
| f6f47785ed | |||
| 3d43a2a08f | |||
| 00ec8d693c | |||
| 1fa96e828e | |||
| c46656ed2d | |||
| 47a9e6728f | |||
| b343071ec2 | |||
| 5383623203 | |||
| 31fff122c3 | |||
| ebc0c31611 | |||
| 52e5bc6277 | |||
| 6892fcde43 | |||
| 7ef2aef377 | |||
| 4b61cad486 | |||
| ad9076162b | |||
| cf82d3c1c1 | |||
| b8f5eccf9c | |||
| 914e4e1b7b | |||
| 2fd37af6ea | |||
| 30b7a8f317 | |||
| f757862ebe | |||
| 462b2f96d3 | |||
| ef79f043a3 | |||
| 7b0221a7a6 | |||
| fe04657c71 | |||
| 77dbf006fe | |||
| 2202e1a8a2 | |||
| 83ebe763d2 | |||
| c82bd280aa | |||
| fe4a6e2e78 | |||
| 08a443333f | |||
| b330f8de82 | |||
| 66ae4e4537 | |||
| e975d0e03f | |||
| 8b1e8176a1 | |||
| 3af985e501 | |||
| 2c60481525 | |||
| 93bbefd40e | |||
| 63865ff1da | |||
| 1b75b3a9a5 | |||
| 21ccf17439 | |||
| b00ae6f008 | |||
| 5b83a2c067 | |||
| a4f1c8c6fa | |||
| abf5962821 | |||
| 1c7b14d803 | |||
| f0c8deee7d | |||
| e96d95700a | |||
| 0e10823448 | |||
| e28b00f76d | |||
| 76dde17573 | |||
| 342b8048f0 | |||
| 9e58b613df | |||
| fe66704aaf | |||
| b62bcbaa73 | |||
| 39039534ba | |||
| fd0092a299 | |||
| 5ec25deaf6 | |||
| af21a6307e | |||
| a7de247f60 | |||
| 12c25bfcab | |||
| 24a32c03fd | |||
| 5c4346d101 | |||
| a4c80dd919 | |||
| ccfd5550b9 | |||
| 5217e04bbf | |||
| 4203f1b1bf | |||
| 02e4536f62 | |||
| ab1ba21823 | |||
| 441327b80f | |||
| eb0df71ef5 | |||
| 50ec426181 | |||
| 949248b994 | |||
| d2e904c557 | |||
| 834d707710 | |||
| 03b3d776b1 | |||
| 3b5df9765e | |||
| 14baa7f7c3 | |||
| 0ecd60184b | |||
| 6fcd65d0dd | |||
| 1ca0cc0fa3 | |||
| b844081956 | |||
| 2724ba2751 | |||
| 1dbf2ea9a3 | |||
| 07c4083005 | |||
| 032133b54a | |||
| e10e0d4b9b | |||
| 22b9b7f2aa | |||
| 97562f189e | |||
| 50daebeb0e | |||
| 4bf23ff7ba | |||
| 013b70d7ad | |||
| aecb0a2ee6 | |||
| 74d2bda1fe | |||
| 918bdd0d95 | |||
| d5108ae684 | |||
| 1165d149f3 | |||
| 4c8f4fa4ea | |||
| be74716f74 | |||
| fdfe5725fd | |||
| 8f33693228 | |||
| d9b5ed096b | |||
| 4cae56a56e | |||
| 2898801b27 | |||
| 5a22fc8fe5 | |||
| ac9642d344 | |||
| f542491a38 | |||
| 64163575e2 | |||
| 2e07a26646 | |||
| 36b1478e32 | |||
| e5b24f25bd | |||
| 6a100245de | |||
| 046c28a387 | |||
| 937e940dd8 | |||
| be7063b4fc | |||
| 70e9342c5d | |||
| 0756a7b507 | |||
| 47f104bcae | |||
| d20e57dca9 | |||
| 09cc10a563 | |||
| b188b3f1b8 | |||
| 99dac8721e | |||
| c93eb4b309 | |||
| 266f12d15a | |||
| 3a18b36df2 | |||
| ebcc022418 | |||
| aa0fb2afcc | |||
| bde2c50696 | |||
| 0945949b37 | |||
| 4fcd65da70 | |||
| afb12dd664 | |||
| 8c5d0e905e | |||
| 92e77720f7 | |||
| 124912368e | |||
| 084f0a06ca | |||
| c08fd0af7f | |||
| 3229685729 | |||
| 77ae021a2f | |||
| 69cf5dcb65 | |||
| 9bd9833ca9 | |||
| 5fb58476ba | |||
| da4a04ad87 | |||
| ae4736d86e | |||
| 198c56cb25 | |||
| 4950b48fc9 | |||
| 3f323588c0 | |||
| e651a8ed6b | |||
| bc9274a8b7 | |||
| 1047374c2b | |||
| 1f2f51fb55 | |||
| 872af0b298 | |||
| bc22e23cda | |||
| 4ca2446dc3 | |||
| 840d6824f0 | |||
| f366e4e267 | |||
| 25436325b2 | |||
| 25d295f4a1 | |||
| f8d874b9d7 | |||
| 959fdaa6de | |||
| c4d672173e | |||
| 262e72c17a | |||
| e260652373 | |||
| 427f7dc230 | |||
| c32ae4a733 | |||
| 34d9d245e1 | |||
| 2a2008b959 | |||
| bab4efa807 | |||
| 5052170046 | |||
| 32fef1e9e4 | |||
| 67ff105cba | |||
| 514baf4fb3 | |||
| 30f9fada39 | |||
| 8b01035d1a | |||
| 883e489ca1 | |||
| d16854ceaf | |||
| bdb5442659 | |||
| f991586f94 | |||
| b7869c36dc | |||
| 83d7aec8f5 | |||
| b43e5b5c80 | |||
| acb792950a | |||
| 41d83719ff | |||
| de1c269a4a | |||
| c3bf62ebf7 | |||
| 317851d982 | |||
| f52d95ae11 | |||
| 6420092c90 | |||
| 2fa108dd67 | |||
| 86bfcfb9f1 | |||
| db65a493dc | |||
| 4dd99a149c | |||
| 5d1fbb2e2b | |||
| 94569cca02 | |||
| 905aaf102b | |||
| d91aa666cc | |||
| 4f90bbc177 | |||
| f6c3bd27fd | |||
| 137c5ceba4 | |||
| c6f5b99373 | |||
| d7f647a8db | |||
| 77277a6af6 | |||
| d9acaec3c5 | |||
| c8692844b6 | |||
| 0b49301e9e | |||
| 30fded4552 | |||
| 9b3b76d1d0 | |||
| f37f22b86b | |||
| 52eedad3da | |||
| 0e2dda597f | |||
| 313511b474 | |||
| d2ed2b5082 | |||
| cce19e1a64 | |||
| 62b84a8909 | |||
| ff7b4f5f3b | |||
| 43a8d8cc2a | |||
| bf09ffd316 | |||
| b0d08e2901 | |||
| 62684ccfda | |||
| 6353231f4a | |||
| 6abd6b139f | |||
| 40358b2551 | |||
| 6e6342f0a6 | |||
| cea485133f | |||
| 08e14a84a5 | |||
| bc179923a0 | |||
| 67ef7ccd7a | |||
| 1abb9691f4 | |||
| 4dc2895781 | |||
| e7635d4b36 | |||
| e731c025b5 | |||
| 8234a16f9e | |||
| 0e3dba7dc8 | |||
| 7e8ef74bee | |||
| 26ef34ef9b | |||
| 4aa6dfa1ee | |||
| 51989254d6 | |||
| 5cfeb49468 | |||
| 614a5f15b5 | |||
| f5a6f17108 | |||
| 6356b82a21 | |||
| b3b1afe77e | |||
| f9628643be | |||
| c8352d567d | |||
| 2b92a0c693 | |||
| 8fec8af0d7 | |||
| 5b83e042c2 | |||
| 525cb154ca | |||
| 1cbd282e40 | |||
| 9ffa32160b | |||
| 872da5f8e1 | |||
| eed3651cb1 | |||
| 653900fd73 | |||
| ff1f2569dd | |||
| 0c6354fc6e | |||
| 2ed5c36890 | |||
| ecaf8edf14 | |||
| 2429cf023a | |||
| c7adc39887 | |||
| f4e267ef1b | |||
| 98bb24d97a | |||
| 9e603a3003 | |||
| 7164541415 | |||
| a51b391634 | |||
| edd3b2a622 | |||
| c55ef5c1f2 | |||
| 65a46796ea | |||
| b4720a1c84 | |||
| 5ec6a88a60 | |||
| cc70ab1fde | |||
| cf58857fd1 | |||
| cc5bacedee | |||
| fe0fe810ab | |||
| 826b7f65f8 | |||
| ce7a380e6e | |||
| a128d295ea | |||
| 85db98ec10 | |||
| 44ae4b9d67 | |||
| d9b4162e63 | |||
| a15ee96156 | |||
| 4e71e8884a | |||
| 346bb2d2b9 | |||
| 0b476c2764 | |||
| bd5854cef3 | |||
| 5d7ae8d632 | |||
| adbca77687 | |||
| 6377a2111c | |||
| c9cc9f1fa7 | |||
| 49e32beb8a | |||
| f6f10aca26 | |||
| cb5d9acf3f | |||
| 903218dabb | |||
| 71f0e5d7cd | |||
| a5e1fbc232 | |||
| 1689ef4e4a | |||
| fb383f9f90 | |||
| 624fc9c77c | |||
| 793b2ee989 | |||
| e56cf991ae | |||
| 1daaab1e93 | |||
| b9f75534ef | |||
| 594dfea986 | |||
| 915403e3c0 | |||
| 0715a4e497 | |||
| 0ab4738e1d | |||
| 0d4f8bbea1 | |||
| ea59149175 | |||
| 87a7350f9a | |||
| 59243d5203 | |||
| 83e2526ce8 | |||
| 1f5718cd67 | |||
| 3d8f2948be | |||
| 6ef713ab3d | |||
| feb377a8f1 | |||
| bce2f27500 | |||
| 5ce65653ad | |||
| ec7138ae2a | |||
| 46644c352d | |||
| 2a3119fe9a | |||
| 6119626f50 | |||
| c004acbfa0 | |||
| da58071a0a | |||
| ab599ef0f7 | |||
| 03f531eff4 | |||
| 09d4d15f72 | |||
| a4cc6570f4 | |||
| 9556aac923 | |||
| 8ef737253c | |||
| 047a743aed | |||
| ab78122036 | |||
| ce918533ab | |||
| e5226c4bf3 | |||
| 98c4764b95 | |||
| 8b31415f5c | |||
| b606431305 | |||
| e2c2717852 | |||
| 4ff6561942 | |||
| f5529b732f | |||
| 397273012c | |||
| 91f1125e6a | |||
| e44a783e9f | |||
| b33a35286d | |||
| 200d763ba4 | |||
| b9b1735d03 | |||
| b88a398343 | |||
| c4199dad4e | |||
| 9034c76096 | |||
| bd6cf76d1d | |||
| ba3a1eb29e | |||
| 88061496d8 | |||
| f0c08d36dd | |||
| 7188af738b | |||
| 3309b79f9c | |||
| f20e942bea | |||
| 92f84d278e | |||
| 9769715295 | |||
| 4e83f2850a | |||
| 599899d960 | |||
| 4c5c89094c | |||
| 896c6fd144 | |||
| 4bb07f1a20 | |||
| 2cd1fb832b | |||
| 9ad517863e | |||
| 7cd7aaa8d0 | |||
| a46fec9016 | |||
| 86d5d22209 | |||
| a07ac77d2b | |||
| 9d3417c6f3 | |||
| 9551213bfb | |||
| f9f27d1d8a | |||
| 2120957968 | |||
| 04e73859f7 | |||
| 208a25899e | |||
| f972f849ae | |||
| 6c4d95406f | |||
| 4f5c6f3afe | |||
| 545cf2c952 | |||
| f4beb731d8 | |||
| af6419971b | |||
| d49ddbeb74 | |||
| 23e96aaf6d | |||
| 360e709ee9 | |||
| 2c935023de | |||
| 4607129933 | |||
| 8f512a620e | |||
| 6fbbd28d23 | |||
| 175b413432 | |||
| e26ce4ce86 | |||
| 6a09d1373e | |||
| 6bdf850c58 | |||
| c36640c1d8 | |||
| f918f40c8d | |||
| 34077272df | |||
| ab6882e5f6 | |||
| ff50f3e1de | |||
| 8b262cf289 | |||
| 1c0fb1d298 | |||
| 98a92da490 | |||
| 5e4d02f2cc | |||
| 3dc8f348c5 | |||
| 674586b844 | |||
| 43a44b08b8 | |||
| c16a30c434 | |||
| 16d18d1052 | |||
| 5b72f4b09e | |||
| 4b2a722308 | |||
| 2e7d0b9b47 | |||
| d2afa89d21 | |||
| c6e34bdab9 | |||
| 6481c2e65e | |||
| c14f4de880 |
@@ -0,0 +1,69 @@
|
||||
# Config file for [Air](https://github.com/air-verse/air) in TOML format
|
||||
|
||||
# Working directory
|
||||
# . or absolute path, please note that the directories following must be under root.
|
||||
root = "."
|
||||
tmp_dir = "storage/temp"
|
||||
|
||||
[build]
|
||||
# Array of commands to run before each build
|
||||
pre_cmd = []
|
||||
# Just plain old shell command. You could use `make` as well.
|
||||
cmd = "go build -o storage/temp/main.exe ./cmd/web"
|
||||
# Array of commands to run after ^C
|
||||
post_cmd = []
|
||||
# Binary file yields from `cmd`.
|
||||
bin = "storage/temp/main.exe"
|
||||
# Customize binary, can setup environment variables when run your app.
|
||||
full_bin = ""
|
||||
# Watch these filename extensions.
|
||||
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||
# Ignore these filename extensions or directories.
|
||||
exclude_dir = ["storage", "web"]
|
||||
# Watch these directories if you specified.
|
||||
include_dir = []
|
||||
# Watch these files.
|
||||
include_file = []
|
||||
# Exclude files.
|
||||
exclude_file = []
|
||||
# Exclude specific regular expressions.
|
||||
exclude_regex = ["_test\\.go"]
|
||||
# Exclude unchanged files.
|
||||
exclude_unchanged = true
|
||||
# Follow symlink for directories
|
||||
follow_symlink = true
|
||||
# This log file places in your tmp_dir.
|
||||
log = "build-errors.log"
|
||||
# It's not necessary to trigger build each time file changes if it's too frequent.
|
||||
delay = 2000
|
||||
# Stop running old binary when build errors occur.
|
||||
stop_on_error = true
|
||||
# Send Interrupt signal before killing process (windows does not support this feature)
|
||||
send_interrupt = false
|
||||
# Delay after sending Interrupt signal
|
||||
kill_delay = 500 # nanosecond
|
||||
# Rerun binary or not
|
||||
rerun = false
|
||||
# Delay after each execution
|
||||
rerun_delay = 500
|
||||
|
||||
[log]
|
||||
# Show log time
|
||||
time = false
|
||||
# Only show main log (silences watcher, build, runner)
|
||||
main_only = false
|
||||
|
||||
[color]
|
||||
# Customize each part's color. If no color found, use the raw app log.
|
||||
main = "magenta"
|
||||
watcher = "cyan"
|
||||
build = "yellow"
|
||||
runner = "green"
|
||||
|
||||
[misc]
|
||||
# Delete tmp directory on exit
|
||||
clean_on_exit = true
|
||||
|
||||
[screen]
|
||||
clear_on_rebuild = true
|
||||
keep_scroll = true
|
||||
@@ -0,0 +1,6 @@
|
||||
*.sh linguist-language=Go
|
||||
*.ts linguist-language=Go
|
||||
*.js linguist-language=Go
|
||||
*.css linguist-language=Go
|
||||
*.scss linguist-language=Go
|
||||
*.html linguist-language=Go
|
||||
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
open_collective: tnb
|
||||
custom: [ 'https://afdian.com/a/TheTNB' ]
|
||||
@@ -0,0 +1,134 @@
|
||||
name: 🐛 报告问题 (Bug Report)
|
||||
description: 创建一个报告以帮助我们改进 (Create a report to help us improve)
|
||||
title: "🐛 [Bug] "
|
||||
labels: [ "☢️ Bug", "bug" ]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**请仅使用 简体中文 或 英文 进行填写**
|
||||
**Please only use Simplified Chinese or English to fill in**
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 在提问之前 (Before Asking)
|
||||
description: |
|
||||
提问之前,先回答几个小问题。
|
||||
Before asking questions, answer a few quick questions.
|
||||
options:
|
||||
- label: 我已经搜索了现有的 Issues, Discussions 和 Google (I've searched the existing Issues, Discussions and Google)
|
||||
required: true
|
||||
- label: 我已经阅读了 README 中除版本记录以外的所有内容 (I've read everything in the README except the version notes)
|
||||
required: true
|
||||
- label: 我在提问题之前至少花费了 5 分钟来思考和准备 (I spend at least 5 minutes thinking and preparing before asking a question)
|
||||
required: true
|
||||
- label: 我没有改动过面板及系统的任何文件 (I have not changed any files of the panel and system)
|
||||
required: false
|
||||
- label: 这个问题可以被稳定复现 (The problem can be stably reproduced)
|
||||
required: false
|
||||
- label: 问题是在升级之后产生的 (The problem is generated after upgrading)
|
||||
required: false
|
||||
- type: dropdown
|
||||
id: system
|
||||
attributes:
|
||||
label: 操作系统 (Operating System)
|
||||
description: |
|
||||
请提供安装面板的操作系统。
|
||||
Please provide the operating system on which the panel is installed.
|
||||
options:
|
||||
- RockyLinux
|
||||
- AlmaLinux
|
||||
- Debian
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: system-version
|
||||
attributes:
|
||||
label: 操作系统版本 (Operating System Version)
|
||||
description: |
|
||||
请提供操作系统的版本号。
|
||||
Please provide the version number of the operating system.
|
||||
placeholder: "9.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: 耗子面板版本 (HaoZi Panel Version)
|
||||
description: |
|
||||
请提供面板的版本号。
|
||||
Please provide the version number of the panel.
|
||||
placeholder: "2.0.0"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: describe
|
||||
attributes:
|
||||
label: 描述问题 (Describe The Problem)
|
||||
description: |
|
||||
简明概要地描述你遇到的问题。
|
||||
Briefly describe the problem you are having.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: 如何复现 (How To Reproduce)
|
||||
description: |
|
||||
重现该问题的详细步骤。
|
||||
Detailed steps to reproduce the problem.
|
||||
value: |
|
||||
1. 安装面板
|
||||
2. 设置 '...'
|
||||
3. 点击 '...'
|
||||
4. 出现问题
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: 预期行为 (Expected Behavior)
|
||||
description: |
|
||||
简明概要地描述你期望发生的事情。
|
||||
Briefly describe what you expect to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: 相关日志 (Related Logs)
|
||||
description: |
|
||||
请复制并粘贴任何相关的日志输出。
|
||||
Please copy and paste any relevant log output.
|
||||
可以把文件拖入这个区域以添加日志文件。
|
||||
Files can be dragged into this area to add log files.
|
||||
面板日志文件可在安装目录 `panel/storage/logs` 中找到。
|
||||
Panel log files can be found in the installation directory `panel/storage/logs`.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: 截图 (Screenshots)
|
||||
description: |
|
||||
如果有,添加屏幕截图可帮助更快定位你的问题。
|
||||
If so, adding screenshots can help locate your issue faster.
|
||||
可以复制图片后在此区域内粘贴以添加图片。
|
||||
Pictures can be copied and pasted in this area to add pictures.
|
||||
如有必要,使用马赛克遮盖敏感信息。
|
||||
Use a mosaic to obscure sensitive information if necessary.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: others
|
||||
attributes:
|
||||
label: 还有别的吗 (Anything Else)
|
||||
description: |
|
||||
运行环境?浏览器?软件版本?相关的配置?链接?参考资料?
|
||||
Environment? Browser? Software version? Related configuration? Link? References?
|
||||
任何能让我们对你所遇到的问题有更多了解的东西。
|
||||
Anything that can give us more insight into the problem you're having.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: ❓ 讨论、问答和非项目问题 (Discussions, questions, and non-project issues)
|
||||
url: https://jq.qq.com/?_wv=1027&k=I1oJKSTH
|
||||
about: 其他不明之处,请移步我们的QQ群 12370907 (For other unclear things, please move to our qq group 12370907)
|
||||
@@ -0,0 +1,55 @@
|
||||
name: ✨ 功能请求 (Feature Request)
|
||||
description: 为这个项目提出一个想法 (Suggest an idea for this project)
|
||||
title: "✨ [Feature] "
|
||||
labels: [ "✏️ Feature", "enhancement" ]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**请仅使用 简体中文 或 英文 进行填写**
|
||||
**Please only use Simplified Chinese or English to fill in**
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: 在提问之前 (Before Asking)
|
||||
description: |
|
||||
提问之前,先回答几个小问题。
|
||||
Before asking questions, answer a few quick questions.
|
||||
options:
|
||||
- label: 我已经搜索了全部 Issues 和 Commits (I have searched all Issues and Commits)
|
||||
required: true
|
||||
- label: 它们当中没有我将要提交的新功能 (None of them have new feature that I'm going to submit)
|
||||
required: true
|
||||
- type: textarea
|
||||
id: feature
|
||||
attributes:
|
||||
label: 描述功能 (Describe Feature)
|
||||
description: |
|
||||
简明概要地描述你的新功能,以及它将解决什么问题。
|
||||
Briefly describe your new feature and what problem it will solve.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: workflow
|
||||
attributes:
|
||||
label: 工作流程 (WorkFlow)
|
||||
description: |
|
||||
请向我们提供有关该功能的实现流程。
|
||||
Please provide us with the implementation flow for this feature.
|
||||
value: |
|
||||
1. 新建文件 ....
|
||||
2. 添加函数 ....
|
||||
3. ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: others
|
||||
attributes:
|
||||
label: 还有别的吗 (Anything Else)
|
||||
description: |
|
||||
运行环境?浏览器?软件版本?相关的配置?链接?参考资料?
|
||||
Environment? Browser? Software version? Related configuration? Link? References?
|
||||
任何能让我们对该功能的实现有更多帮助的东西。
|
||||
Anything that can help us more with the implementation of this feature.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,55 @@
|
||||
name: Backend
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
matrix:
|
||||
goarch: [ amd64, arm64 ]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Install dependencies
|
||||
run: go mod tidy
|
||||
- name: Wait for frontend build
|
||||
uses: lewagon/wait-on-check-action@v1.3.4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
check-name: 'build (frontend)'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Download frontend
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: frontend.yml
|
||||
name: frontend
|
||||
path: internal/embed/frontend
|
||||
check_artifacts: true
|
||||
- name: Build ${{ matrix.goarch }}
|
||||
env:
|
||||
CGO_ENABLED: 0
|
||||
GOOS: linux
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
run: |
|
||||
go build -ldflags '-s -w --extldflags "-static"' -o web-${{ matrix.goarch }} ./cmd/web
|
||||
go build -ldflags '-s -w --extldflags "-static"' -o cli-${{ matrix.goarch }} ./cmd/cli
|
||||
- name: Compress ${{ matrix.goarch }}
|
||||
run: |
|
||||
upx --best --lzma web-${{ matrix.goarch }}
|
||||
upx --best --lzma cli-${{ matrix.goarch }}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.goarch }}
|
||||
path: |
|
||||
web-${{ matrix.goarch }}
|
||||
cli-${{ matrix.goarch }}
|
||||
@@ -0,0 +1,26 @@
|
||||
name: Codecov
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
jobs:
|
||||
codecov:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Install dependencies
|
||||
run: go mod tidy
|
||||
- name: Run tests with coverage
|
||||
run: go test -v -coverprofile="coverage.out" ./...
|
||||
- name: Upload coverage report to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.out
|
||||
token: ${{ secrets.CODECOV }}
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Frontend
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
name: build (frontend)
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
run_install: true
|
||||
package_json_file: web/package.json
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
- name: Build frontend
|
||||
# We need to run the dev server first to generate the auto-imports files
|
||||
run: |
|
||||
cp .env.production .env
|
||||
cp settings/proxy-config.ts.example settings/proxy-config.ts
|
||||
pnpm dev &
|
||||
sleep 5
|
||||
kill %1
|
||||
pnpm build
|
||||
- name: Upload frontend
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend
|
||||
path: web/dist/ # https://github.com/actions/upload-artifact/issues/541
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Wait for frontend build
|
||||
uses: lewagon/wait-on-check-action@v1.3.4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
check-name: 'build (frontend)'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Download frontend
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: frontend.yml
|
||||
name: frontend
|
||||
path: internal/embed/frontend
|
||||
check_artifacts: true
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
version: latest
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Issue Auto Reply
|
||||
on:
|
||||
issues:
|
||||
types: [ labeled ]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
issue-reply:
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: ✏️ Feature
|
||||
if: github.event.label.name == '✏️ Feature'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Hi @${{ github.event.issue.user.login }} 👋
|
||||
|
||||
我们认为您的建议非常有价值!欢迎提交 PR,请包含相应的测试用例、文档等,并确保 CI 通过,感谢和期待您的贡献!
|
||||
We think your suggestion is very valuable! Welcome to submit a PR, please include test cases, documentation, etc., and ensure that the CI is passed, thank you and look forward to your contribution!
|
||||
|
||||

|
||||
- name: ☢️ Bug
|
||||
if: github.event.label.name == '☢️ Bug'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Hi @${{ github.event.issue.user.login }} 👋
|
||||
|
||||
我们认为您的反馈非常有价值!欢迎提交 PR,请包含相应的测试用例、文档等,并确保 CI 通过,感谢和期待您的贡献!
|
||||
We think your feedback is very valuable! Welcome to submit a PR, please include test cases, documentation, etc., and ensure that the CI is passed, thank you and look forward to your contribution!
|
||||
|
||||

|
||||
@@ -0,0 +1,79 @@
|
||||
name: Lint
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
golangci:
|
||||
name: golanci-lint
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Run golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
skip-cache: true
|
||||
version: latest
|
||||
args: --timeout=30m ./...
|
||||
nilaway:
|
||||
runs-on: ubuntu-24.04
|
||||
if: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Install dependencies
|
||||
run: go mod tidy
|
||||
- name: Install NilAway
|
||||
run: go install go.uber.org/nilaway/cmd/nilaway@latest
|
||||
- name: Run NilAway
|
||||
run: nilaway -include-pkgs="github.com/TheTNB/panel" ./...
|
||||
govulncheck:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Install Govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
- name: Run Govulncheck
|
||||
run: govulncheck ./...
|
||||
frontend:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
run_install: true
|
||||
package_json_file: web/package.json
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
- name: Run pnpm lint
|
||||
run: pnpm lint
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
jobs:
|
||||
unit:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: true
|
||||
go-version: 'stable'
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install -y curl jq
|
||||
- name: Set up environment
|
||||
run: |
|
||||
cp config.example.yml config.yml
|
||||
- name: Run tests
|
||||
run: go test ./...
|
||||
+64
-2
@@ -1,3 +1,65 @@
|
||||
.idea
|
||||
# `go test -c` 生成的二进制文件
|
||||
*.test
|
||||
|
||||
# go coverage 工具
|
||||
*.out
|
||||
*.prof
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
# 编译文件
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# 压缩包
|
||||
# Git 自带压缩,如果这些压缩包里有代码,建议解压后 commit
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# 日志文件和数据库及配置
|
||||
*.log
|
||||
*.sqlite
|
||||
*.db
|
||||
config.yml
|
||||
|
||||
# 临时文件
|
||||
tmp/
|
||||
.tmp/
|
||||
|
||||
# 系统生成文件
|
||||
.DS_Store
|
||||
vendor/
|
||||
.DS_Store?
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.TemporaryItems
|
||||
.fseventsd
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# IDE 和编辑器
|
||||
.idea/
|
||||
/go_build_*
|
||||
out/
|
||||
.vscode/
|
||||
.vscode/settings.json
|
||||
*.sublime*
|
||||
__debug_bin
|
||||
.project
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
version: 2
|
||||
project_name: panel
|
||||
|
||||
builds:
|
||||
- id: web
|
||||
main: ./cmd/web
|
||||
binary: web
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
ldflags:
|
||||
- -s -w --extldflags "-static"
|
||||
- id: cli
|
||||
main: ./cmd/cli
|
||||
binary: cli
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
ldflags:
|
||||
- -s -w --extldflags "-static"
|
||||
|
||||
upx:
|
||||
- enabled: true
|
||||
# Filter by build ID.
|
||||
ids:
|
||||
- web
|
||||
- cli
|
||||
# Compress argument.
|
||||
# Valid options are from '1' (faster) to '9' (better), and 'best'.
|
||||
compress: best
|
||||
# Whether to try LZMA (slower).
|
||||
lzma: true
|
||||
# Whether to try all methods and filters (slow).
|
||||
brute: false
|
||||
|
||||
archives:
|
||||
- id: panel
|
||||
builds:
|
||||
- web
|
||||
- cli
|
||||
format: zip
|
||||
wrap_in_directory: false
|
||||
strip_binary_directory: true
|
||||
files:
|
||||
- LICENSE
|
||||
- config.example.yml
|
||||
- storage/*
|
||||
@@ -1,98 +0,0 @@
|
||||
# 更新日志
|
||||
|
||||
所有重要的更改都将在此文件中记录。
|
||||
|
||||
## [20230130] - 常规更新
|
||||
|
||||
- 优化数据库备份流程
|
||||
|
||||
## [20230130] - 常规更新
|
||||
|
||||
- 代码格式化
|
||||
- 更新许可证
|
||||
- 修复更新备份逻辑错误
|
||||
- 主页新增新年祝福
|
||||
- 主页新增检查更新
|
||||
|
||||
## [20230113] - 常规更新
|
||||
|
||||
- 优化更新流程
|
||||
- 优化备份流程
|
||||
|
||||
## [20230108] - 常规更新
|
||||
|
||||
- 提升面板安全性
|
||||
- 修复网站删除报错的Bug
|
||||
- 规范网站名称
|
||||
|
||||
## [20221222] - 常规更新
|
||||
|
||||
- 优化计划任务日志格式
|
||||
- 网站管理支持分页
|
||||
- 文件管理的初步实现
|
||||
- 样式微调
|
||||
- 部分代码优化
|
||||
- 框架版本更新
|
||||
|
||||
## [20221212] - 常规更新
|
||||
|
||||
- 修复创建网站可能重复添加listen端口的Bug
|
||||
|
||||
## [20221210] - 安全更新
|
||||
|
||||
- 增强面板安全性
|
||||
- 其他微调及Bug修复
|
||||
|
||||
## [20221208] - 常规更新
|
||||
|
||||
- 新增网站免费SSL证书申请
|
||||
- 前端细节优化
|
||||
|
||||
## [20221205] - 常规更新
|
||||
|
||||
- 新增自动备份插件(需配合20221203+版本的面板使用)
|
||||
- 优化面板命令行显示
|
||||
- 前端细节优化
|
||||
|
||||
## [20221203] - 常规更新
|
||||
|
||||
- 修复禁用Ping不生效的问题
|
||||
- 修复网站设置PHP版本未赋值的问题
|
||||
- 新增网站目录备份功能
|
||||
- 新增面板多用户登录功能
|
||||
- 新增资源监控时间选择功能
|
||||
- 实装网站运行状态设置功能
|
||||
- 实装网站配置文件重置功能
|
||||
- 前端多处优化
|
||||
|
||||
## [20221202] - 常规更新
|
||||
|
||||
- 修复网站添加数据库不能为空的问题
|
||||
- 校验网站目录必须以/开头
|
||||
- 修复网站名可以编辑的问题
|
||||
- 新增面板API开关
|
||||
- 新增计划任务模块
|
||||
- 安装脚本优化,提高在不同地区下的安装成功率
|
||||
|
||||
## [20221201] - 首版发布
|
||||
|
||||
- 修复了二测时发现的一些问题
|
||||
- 首发于Hostloc,感谢各位mjj大佬的支持。
|
||||
|
||||
## [20221130] - 内部二测
|
||||
|
||||
- 内部二测
|
||||
- 修复了一测发现的问题
|
||||
- 新增了一些插件,基本功能已经完善
|
||||
|
||||
## [20221121] - 内部一测
|
||||
|
||||
- 内部一测
|
||||
|
||||
## 2022-10 - 2022-11
|
||||
|
||||
- 重构版本开始开发
|
||||
|
||||
## 2022-07 - 2022-08
|
||||
|
||||
- 项目启动、早期开发
|
||||
@@ -0,0 +1,17 @@
|
||||
## 行为准则
|
||||
|
||||
耗子面板遵守业界通用的行为准则。任何违反行为准则的行为都可以报告给我们:
|
||||
|
||||
- 参与者将容忍反对意见。
|
||||
- 参与者必须确保他们的语言和行为没有人身攻击和贬低个人言论。
|
||||
- 在解释他人的言行时,参与者应始终保持良好的意图。
|
||||
- 不能容忍可合理视为骚扰的行为。
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
The Rat Panel complies with the industry's common code of conduct. Any breach of the Code of Conduct can be reported to us:
|
||||
|
||||
- Participants will be tolerant of opposing views.
|
||||
- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
||||
- When interpreting the words and actions of others, participants should always assume good intentions.
|
||||
- Behavior that can be reasonably considered harassment will not be tolerated.
|
||||
@@ -1,202 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
Preamble
|
||||
|
||||
1. Definitions.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
0. Definitions.
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
1. Source Code.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
2. Basic Permissions.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
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.
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -1,35 +1,140 @@
|
||||
耗子Linux面板
|
||||
===============
|
||||
<p align="right">
|
||||
[简体中文] | [<a href="README_EN.md">English</a>]
|
||||
</p>
|
||||
|
||||
#### 这是耗子Linux面板的开源仓库,基于Apache License 2.0协议进行开源,目前处于积极开发状态。
|
||||
<h1 align="center" style="font-size: 40px">耗子面板</h1>
|
||||
|
||||
#### 我们正在进行基于 Golang 的 V2 版本的开发,加入我们的 交流QQ群:[12370907](https://jq.qq.com/?_wv=1027&k=I1oJKSTH) | QQ频道:[耗子](https://pd.qq.com/s/fyol46wfy) 获取最新动态。
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/10950" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10950" alt="TheTNB%2Fpanel | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/TheTNB/panel/releases"><img src="https://img.shields.io/github/release/TheTNB/panel.svg"></a>
|
||||
<a href="https://github.com/TheTNB/panel/actions"><img src="https://github.com/TheTNB/panel/actions/workflows/test.yml/badge.svg"></a>
|
||||
<a href="https://goreportcard.com/report/github.com/TheTNB/panel"><img src="https://goreportcard.com/badge/github.com/TheTNB/panel"></a>
|
||||
<a href="https://img.shields.io/github/license/TheTNB/panel"><img src="https://img.shields.io/github/license/TheTNB/panel"></a>
|
||||
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2FTheTNB%2Fpanel?ref=badge_shield"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2FTheTNB%2Fpanel.svg?type=shield" alt="FOSSA Status"></a>
|
||||
</p>
|
||||
|
||||
耗子面板是使用 Golang + Vue 开发的开源轻量 Linux 服务器运维管理面板。
|
||||
|
||||
交流QQ群:[12370907](https://jq.qq.com/?_wv=1027&k=I1oJKSTH) | 论坛:[tom.moe](https://tom.moe) | 赞助:[爱发电](https://afdian.com/a/TheTNB)
|
||||
|
||||
## 优势
|
||||
|
||||
1. **极低占用:** 在 Debian 下部署面板 + LNMP 环境,内存占用不到 500 MB,遥遥领先于使用容器化的其他面板。
|
||||
2. **低破坏性:** 面板的设计理念是尽可能减少对系统的额外修改,在同类面板中,我们对系统的修改最少。
|
||||
3. **追随时代:** 面板所有组件均走在时代前沿,更新快,功能强大,安全性有保障。
|
||||
4. **高效运维:** 面板界面简洁,操作简单,无需繁琐的配置,即可快速部署各类环境、调整应用设置。
|
||||
5. **离线运行:** 面板运行可不依赖任何外部服务,你甚至可以在部署完成后停止面板进程,不会对已部署服务造成任何影响。
|
||||
6. **久经考验:** 我们生产环境自 2022 年即开始使用,已稳定运行 2 年无事故。
|
||||
7. **开源开放:** 面板开源,你可以自由修改、审计面板源码,安全性有保障。
|
||||
|
||||
## UI 截图
|
||||
|
||||

|
||||
|
||||
## 运行环境
|
||||
|
||||
| 系统 | 版本 |
|
||||
|---------------|-----|
|
||||
| CentOS Stream | 9 |
|
||||
| CentOS Stream | 8 |
|
||||
| RockyLinux | 9 |
|
||||
| RockyLinux | 8 |
|
||||
| AlmaLinux | 9 |
|
||||
| AlmaLinux | 8 |
|
||||
| 其他RHEL发行版 | 8 |
|
||||
| 其他RHEL发行版 | 9 |
|
||||
耗子面板支持 `amd64` | `arm64` 架构下的主流系统。
|
||||
|
||||
广告: [`WeAvatar` —统一头像服务](https://weavatar.com)
|
||||
优先建议使用 `AlmaLinux` | `RockyLinux`。
|
||||
|
||||
服务器赞助:
|
||||
[](http://www.ddunyun.com/aff/PNYAXMKI)
|
||||
## 安装说明
|
||||
不在下表中的其他系统,可自行尝试安装,但不保证能够正常运行,且不提供技术支持。
|
||||
|
||||
| 系统 | 版本 |
|
||||
|------------|----|
|
||||
| RHEL | 9 |
|
||||
| AlmaLinux | 9 |
|
||||
| RockyLinux | 9 |
|
||||
| Ubuntu | 22 |
|
||||
| Ubuntu | 24 |
|
||||
| Debian | 11 |
|
||||
| Debian | 12 |
|
||||
|
||||
随着系统版本的不断更新,我们亦可能会终止部分过于老旧的系统的支持,以保证面板的健壮性。
|
||||
|
||||
## 安装面板
|
||||
|
||||
> **Warning**
|
||||
> 安装面板前,你需要了解 LNMP 环境的基本知识,以及如何处理常见的 LNMP 环境问题,我们不建议 0 基础的用户安装和使用耗子面板。
|
||||
|
||||
如果你决定继续,请以`root`用户登录服务器,执行以下命令安装面板:
|
||||
|
||||
**当前 v2.3.x 为测试版本,欢迎帮助我们测试在不同操作系统下的兼容性。**
|
||||
|
||||
```shell
|
||||
wget -O install_panel.sh https://dl.panel.haozi.xyz/script/install_panel.sh && bash install_panel.sh
|
||||
curl -fsLm 10 -o install.sh https://dl.cdn.haozi.net/panel/install.sh && bash install.sh
|
||||
```
|
||||
|
||||
## 更新说明
|
||||
## 卸载面板
|
||||
|
||||
优先建议备份数据重装系统,这样可以保证系统纯净。
|
||||
|
||||
如果你无法重装系统,请以`root`用户登录服务器,执行以下命令卸载面板:
|
||||
|
||||
```shell
|
||||
panel update
|
||||
curl -fsLm 10 -o uninstall.sh https://dl.cdn.haozi.net/panel/uninstall.sh && bash uninstall.sh
|
||||
```
|
||||
|
||||
卸载面板前请务必备份好所有数据,提前卸载面板全部应用。卸载后数据将**无法恢复**!
|
||||
|
||||
## 日常维护
|
||||
|
||||
使用`panel-cli`命令进行日常维护:
|
||||
|
||||
```shell
|
||||
panel-cli
|
||||
```
|
||||
|
||||
在 [文档](https://tom.moe/docs?category=57) 中查看更多使用方法和技巧。
|
||||
|
||||
## 问题反馈
|
||||
|
||||
使用类问题,可在 [Moe Tom](https://tom.moe) 提问或寻求 AI 帮助,亦可在群里寻求付费支持。
|
||||
|
||||
面板自身问题,可在 GitHub 的`Issues`页面提交问题反馈,注意[提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md)。
|
||||
|
||||
## 赞助商
|
||||
|
||||
如果耗子面板对你有帮助,欢迎[赞助我们](https://afdian.com/a/TheTNB),感谢以下支持者/赞助商的支持:
|
||||
|
||||
**同时接受云资源赞助,可通过QQ群咨询联系**
|
||||
|
||||
### 资金
|
||||
|
||||
- [微晓朵](https://www.weixiaoduo.com/)
|
||||
|
||||
### CDN
|
||||
|
||||
- [无畏云加速](https://su.sctes.com/register?code=8st689ujpmm2p)
|
||||
- [WAF PRO](https://waf.pro/)
|
||||
- [盾云SCDN](https://scdn.ddunyun.com/)
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://afdian.com/a/TheTNB">
|
||||
<img alt="sponsors" src="https://github.com/TheTNB/sponsor/blob/main/sponsors.svg?raw=true"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## 贡献者
|
||||
|
||||
这个项目的存在要归功于所有做出贡献的人,参与贡献请先查看贡献代码部分。
|
||||
|
||||
<a href="https://github.com/TheTNB/panel/graphs/contributors">
|
||||
<img alt="contributors" src="https://contrib.rocks/image?repo=TheTNB/panel"/>
|
||||
</a>
|
||||
|
||||
## Star 历史
|
||||
|
||||
<a href="https://star-history.com/#TheTNB/panel&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## 免责声明
|
||||
|
||||
严禁使用耗子面板从事任何非法活动,非法站点请勿向我们请求任何形式的技术支持,如果在技术支持过程中发现非法内容,我们将立即停止技术支持并留存相关证据。
|
||||
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
<p align="right">
|
||||
[<a href="README.md">简体中文</a>] | [English]
|
||||
</p>
|
||||
|
||||
<h1 align="center" style="font-size: 40px">Rat Panel</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://trendshift.io/repositories/10950" target="_blank"><img src="https://trendshift.io/api/badge/repositories/10950" alt="TheTNB%2Fpanel | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/TheTNB/panel/releases"><img src="https://img.shields.io/github/release/TheTNB/panel.svg"></a>
|
||||
<a href="https://github.com/TheTNB/panel/actions"><img src="https://github.com/TheTNB/panel/actions/workflows/test.yml/badge.svg"></a>
|
||||
<a href="https://goreportcard.com/report/github.com/TheTNB/panel"><img src="https://goreportcard.com/badge/github.com/TheTNB/panel"></a>
|
||||
<a href="https://img.shields.io/github/license/TheTNB/panel"><img src="https://img.shields.io/github/license/TheTNB/panel"></a>
|
||||
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2FTheTNB%2Fpanel?ref=badge_shield"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2FTheTNB%2Fpanel.svg?type=shield" alt="FOSSA Status"></a>
|
||||
</p>
|
||||
|
||||
The Rat Panel is an open source lightweight Linux server operation and maintenance management panel developed using Golang and Vue.
|
||||
|
||||
Communication QQ group: [12370907](https://jq.qq.com/?_wv=1027&k=I1oJKSTH) | Forum: [tom.moe](https://tom.moe) | Sponsor: [Open Collective](https://opencollective.com/tnb)
|
||||
|
||||
## Advantages
|
||||
|
||||
1. **Extremely low usage:** Deploying the panel + LNMP environment under Debian, the memory usage is less than 500 MB, far ahead of other panels using containerization.
|
||||
2. **Low destructiveness:** The design concept of the panel is to minimize the additional modifications to the system. Among similar panels, we have made the least modifications to the system.
|
||||
3. **Follow the times:** All components of the panel are at the forefront of the times, updated quickly, powerful functions, and guaranteed security.
|
||||
4. **Efficient operation and maintenance:** The panel is simple and easy to operate, and you can quickly deploy various environments and adjust application settings without complicated configuration.
|
||||
5. **Offline operation:** The panel can run without relying on any external services. You can even stop the panel process after deployment is complete, and it will not affect the deployed services.
|
||||
6. **Tested by time:** We have been using it in production environment since 2022, and it has been running stably for 2 year without any accidents.
|
||||
7. **Open source and open:** The panel is open source, you can freely modify and audit the panel source code, and the security is guaranteed.
|
||||
|
||||
## UI Screenshots
|
||||
|
||||

|
||||
|
||||
## Operating Environment
|
||||
|
||||
Rat Panel supports mainstream systems under the `amd64` | `arm64` architecture.
|
||||
|
||||
It is recommended to use `AlmaLinux` | `RockyLinux` first.
|
||||
|
||||
For other systems not listed in the table below, you can try to install them by yourself, but there is no guarantee that they will run normally, and no technical support will be provided.
|
||||
|
||||
| OS | Version |
|
||||
|------------|---------|
|
||||
| RHEL | 9 |
|
||||
| RockyLinux | 9 |
|
||||
| AlmaLinux | 9 |
|
||||
| Ubuntu | 22 |
|
||||
| Ubuntu | 24 |
|
||||
| Debian | 11 |
|
||||
| Debian | 12 |
|
||||
|
||||
As system versions are constantly updated, we may also terminate support for some older systems to ensure the robustness of the panel.
|
||||
|
||||
## Install Panel
|
||||
|
||||
> **Warning**
|
||||
> Before installing the panel, you need to understand the basic knowledge of the LNMP environment and how to deal with common LNMP environment problems. We are not recommended for users with zero basic knowledge to install and use Rat Panel.
|
||||
|
||||
If you decide to continue, please log in to the server as `root` user and execute the following command to install the panel:
|
||||
|
||||
**Current v2.3.x is a test version, welcome to help us test compatibility on different operating systems.**
|
||||
|
||||
```shell
|
||||
curl -fsLm 10 -o install.sh https://dl.cdn.haozi.net/panel/install.sh && bash install.sh
|
||||
```
|
||||
|
||||
## Uninstall Panel
|
||||
|
||||
Recommended to back up data and reinstall the system first, so that the system can be kept clean.
|
||||
|
||||
If you are unable to reinstall the system, log in to the server as the `root` user and execute the following command to uninstall the panel:
|
||||
|
||||
```shell
|
||||
curl -fsLm 10 -o uninstall.sh https://dl.cdn.haozi.net/panel/uninstall.sh && bash uninstall.sh
|
||||
```
|
||||
|
||||
Before uninstalling the panel, please be sure to back up all data and uninstall all panel plugins in advance. The data will **not be recoverable** after uninstallation!
|
||||
|
||||
## Daily Maintenance
|
||||
|
||||
Use `panel-cli` command for daily maintenance:
|
||||
|
||||
```shell
|
||||
panel-cli
|
||||
```
|
||||
|
||||
See more usage methods and tips in [Document](https://tom.moe/docs?category=57).
|
||||
|
||||
## Feedback
|
||||
|
||||
For usage issues, you can ask questions in the [Moe Tom](https://tom.moe) or seek AI help. You can also seek paid support in the group.
|
||||
|
||||
For issues with the panel itself, you can submit feedback on the `Issues` page of GitHub. Please note [the wisdom of asking questions](http://www.catb.org/~esr/faqs/smart-questions.html).
|
||||
|
||||
## Sponsor
|
||||
|
||||
If the Rat Panel is helpful to you, welcome to [sponsor us](https://opencollective.com/tnb), thanks to the following supporters/sponsors:
|
||||
|
||||
**Accept cloud resources and financial sponsorship, you can contact us through QQ group**
|
||||
|
||||
### Financial
|
||||
|
||||
- [微晓朵](https://www.weixiaoduo.com/)
|
||||
|
||||
### CDN
|
||||
|
||||
- [无畏云加速](https://su.sctes.com/register?code=8st689ujpmm2p)
|
||||
- [WAF PRO](https://waf.pro/)
|
||||
- [盾云SCDN](https://scdn.ddunyun.com/)
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://afdian.com/a/TheTNB">
|
||||
<img alt="sponsors" src="https://github.com/TheTNB/sponsor/blob/main/sponsors.svg?raw=true"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Contributor
|
||||
|
||||
This project owes its existence to all those who have contributed. To contribute, please check the contributed code section first.
|
||||
|
||||
<a href="https://github.com/TheTNB/panel/graphs/contributors">
|
||||
<img alt="contributors" src="https://contrib.rocks/image?repo=TheTNB/panel"/>
|
||||
</a>
|
||||
|
||||
## Star History
|
||||
|
||||
<a href="https://star-history.com/#TheTNB/panel&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=TheTNB/panel&type=Date" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
## Disclaimer
|
||||
|
||||
It is strictly prohibited to use the Rat Panel to engage in any illegal activities. Please do not request any form of technical support from us for illegal sites. If illegal content is discovered during the technical support process, we will immediately stop technical support and retain relevant evidence.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
## 安全说明
|
||||
|
||||
**我们不对面板的安全性做任何保证**,但安全性是我们最关心的问题之一,我们已在多个不同应用的生产环境广泛应用耗子面板,至今无任何安全事故。
|
||||
|
||||
如果您在面板中发现任何安全问题,请勿提交 Issue,可通过以下方式直接联系我们:
|
||||
|
||||
- 邮箱:[admin@haozi.net](mailto:admin@haozi.net)
|
||||
- QQ:826896000
|
||||
|
||||
提前感谢您的支持与帮助!
|
||||
|
||||
致某些安全初学者:通过面板 `session` / `access_token` 执行的任何操作(包括且不限于:获取 root 权限、读取/写入系统敏感文件、执行任意 shell 命令等)均不被认为是安全问题,请不要刷此类报告浪费彼此的时间,这类低水平的报告对你的简历也没有任何帮助。
|
||||
|
||||
## Security Policy
|
||||
|
||||
**We do not make any guarantees about the security of the panel**, but security is one of our top concerns. We have widely used the Rat panel in the production environment of multiple different applications, and there has been no security incidents to date.
|
||||
|
||||
If you find any security issues while using the panel, please do not submit an Issue. You can contact us directly through the following methods:
|
||||
|
||||
- Email: [admin@haozi.net](mailto:admin@haozi.net)
|
||||
- Telegram: @devhaozi
|
||||
|
||||
Thank you in advance for your support and help!
|
||||
|
||||
To some security beginners: Any operation performed through the panel `session` / `access_token` (including but not limited to: obtaining root permissions, reading/writing sensitive system files, executing arbitrary shell commands, etc.) is not considered a security issue. Please do not waste each other's time by submitting such reports. Such low-level reports are of no help to your resume.
|
||||
@@ -1,142 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Monitor as MonitorModel;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Monitor extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'monitor';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '耗子Linux面板 - 系统监控';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if (Setting::query()->where('name', 'monitor')->value('value')) {
|
||||
$info = self::getNowMonitor();
|
||||
MonitorModel::query()->create(['info' => json_encode($info)]);
|
||||
// 删除过期的记录
|
||||
$days = Setting::query()->where('name', 'monitor_days')->value('value');
|
||||
MonitorModel::query()->where('created_at', '<', Carbon::now()->subDays($days))->delete();
|
||||
$this->info(time().' 监控完成');
|
||||
} else {
|
||||
$this->info('监控未开启');
|
||||
}
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统资源统计
|
||||
* @return array
|
||||
*/
|
||||
private function getNowMonitor(): array
|
||||
{
|
||||
// 第一次获取网络信息
|
||||
$netInfo1 = getNetInfo();
|
||||
// 卡它一秒钟
|
||||
sleep(1);
|
||||
// 第二次获取网络信息
|
||||
$netInfo2 = getNetInfo();
|
||||
|
||||
// CPU统计信息及负载
|
||||
$cpuInfoRaw = file_get_contents('/proc/cpuinfo');
|
||||
$physicalArr = array();
|
||||
$siblingsSum = 0;
|
||||
preg_match("/(\d+\.\d+), (\d+\.\d+), (\d+\.\d+)/", exec('uptime'), $uptime);
|
||||
$uptime1 = $uptime[1] ?? 0;
|
||||
|
||||
$processorArr = explode("\nprocessor", $cpuInfoRaw);
|
||||
foreach ($processorArr as $v) {
|
||||
preg_match("/physical id\s*:\s(.*)/", $v, $physical);
|
||||
preg_match("/siblings\s*:\s(.*)/", $v, $siblings);
|
||||
if (isset($physical[1])) {
|
||||
if (!in_array($physical[1], $physicalArr)) {
|
||||
if (isset($siblings[1])) {
|
||||
$siblingsSum += $siblings[1];
|
||||
}
|
||||
}
|
||||
$physicalArr[] = $physical[1];
|
||||
}
|
||||
}
|
||||
|
||||
// CPU使用率
|
||||
$cpuUse = 0.1;
|
||||
$cpuRaw = explode("\n", shell_exec('ps aux'));
|
||||
// 弹出第一项和最后一项
|
||||
array_pop($cpuRaw);
|
||||
array_shift($cpuRaw);
|
||||
// 获取当前php进程的pid
|
||||
$pid = getmypid();
|
||||
foreach ($cpuRaw as $v) {
|
||||
$v = preg_replace("/\s+/", " ", $v);
|
||||
$v = (explode(' ', $v));
|
||||
// 排除当前进程
|
||||
if ($v[1] == $pid) {
|
||||
continue;
|
||||
}
|
||||
$cpuUse += isset($v[2]) ? (float) $v[2] : 0;
|
||||
}
|
||||
$cpuUse = $siblingsSum > 0 ? ($cpuUse / $siblingsSum) : $cpuUse;
|
||||
$cpuUse = round($cpuUse, 2);
|
||||
$cpuUse = min($cpuUse, 100);
|
||||
|
||||
|
||||
// 内存使用率
|
||||
$memRaw = explode("\n", shell_exec('free -m'));
|
||||
foreach ($memRaw as $v) {
|
||||
if (str_contains($v, 'Mem')) {
|
||||
$memList = preg_replace("/\s+/", " ", $v);
|
||||
} elseif (str_contains($v, 'Swap')) {
|
||||
$swapList = preg_replace("/\s+/", " ", $v);
|
||||
}
|
||||
}
|
||||
$memArr = explode(' ', $memList);
|
||||
$swapArr = explode(' ', $swapList);
|
||||
// 内存大小MB
|
||||
$memTotal = $memArr[1];
|
||||
// Swap大小MB
|
||||
$swapTotal = $swapArr[1];
|
||||
// 使用中MB
|
||||
$memUse = (str_contains($memRaw[0], 'buff/cache')) ? $memArr[2] : ($memArr[2] - $memArr[5] - $memArr[6]);
|
||||
// Swap使用中MB
|
||||
$swapUse = $swapArr[2];
|
||||
// 使用中%
|
||||
$memUseP = round($memUse / $memTotal, 2) * 100;
|
||||
// Swap使用中%
|
||||
$swapUseP = round($swapUse / $swapTotal, 2) * 100;
|
||||
// 1分钟负载%
|
||||
$uptime1P = round(min($uptime1 * 10, 100), 2);
|
||||
|
||||
// 构建返回数组
|
||||
$res['cpu_use'] = $cpuUse;
|
||||
$res['uptime'] = $uptime1;
|
||||
$res['uptime_p'] = $uptime1P;
|
||||
$res['mem_total'] = $memTotal;
|
||||
$res['mem_use'] = $memUse;
|
||||
$res['mem_use_p'] = $memUseP;
|
||||
$res['swap_total'] = $swapTotal;
|
||||
$res['swap_use'] = $swapUse;
|
||||
$res['swap_use_p'] = $swapUseP;
|
||||
$res['tx_now'] = $netInfo2['tx'] - $netInfo1['tx'];
|
||||
$res['rx_now'] = $netInfo2['rx'] - $netInfo1['rx'];
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
@@ -1,537 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Plugin;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Task;
|
||||
use App\Models\User;
|
||||
use App\Models\Website;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Command\Command as CommandAlias;
|
||||
|
||||
class Panel extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'panel {action?} {a1?} {a2?} {a3?} {a4?} {a5?} {a6?} {a7?} {a8?} {a9?} {a10?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '耗子Linux面板命令行工具';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
// 检测是否以root用户运行
|
||||
if (trim(shell_exec('whoami')) != 'root') {
|
||||
$this->error('耗子Linux面板:请以root用户运行');
|
||||
return 1;
|
||||
}
|
||||
$action = $this->argument('action');
|
||||
switch ($action) {
|
||||
case 'init':
|
||||
$this->init();
|
||||
break;
|
||||
case 'update':
|
||||
$this->update();
|
||||
break;
|
||||
case 'getInfo':
|
||||
$this->getInfo();
|
||||
break;
|
||||
case 'getPort':
|
||||
$this->getPort();
|
||||
break;
|
||||
case 'writePluginInstall':
|
||||
$this->writePluginInstall();
|
||||
break;
|
||||
case 'writePluginUnInstall':
|
||||
$this->writePluginUnInstall();
|
||||
break;
|
||||
case 'writeMysqlPassword':
|
||||
$this->writeMysqlPassword();
|
||||
break;
|
||||
case 'cleanRunningTask':
|
||||
$this->cleanRunningTask();
|
||||
break;
|
||||
case 'backup':
|
||||
$this->backup();
|
||||
break;
|
||||
case 'writeSite':
|
||||
$this->writeSite();
|
||||
break;
|
||||
case 'deleteSite':
|
||||
$this->deleteSite();
|
||||
break;
|
||||
case 'writeSetting':
|
||||
$this->writeSetting();
|
||||
break;
|
||||
case 'deleteSetting':
|
||||
$this->deleteSetting();
|
||||
break;
|
||||
default:
|
||||
$this->info('耗子Linux面板命令行工具');
|
||||
$this->info('请使用以下命令:');
|
||||
$this->info('panel update 更新/修复面板到最新版本');
|
||||
$this->info('panel getInfo 重新初始化面板账号信息');
|
||||
$this->info('panel getPort 获取面板访问端口');
|
||||
$this->info('panel cleanRunningTask 强制清理面板正在运行的任务');
|
||||
$this->info('panel backup {website/mysql/postgresql} {name} {path} 备份网站/MySQL数据库/PostgreSQL数据库到指定目录');
|
||||
$this->warn('以下命令请在开发者指导下使用:');
|
||||
$this->info('panel init 初始化面板');
|
||||
$this->info('panel writePluginInstall {slug} 写入插件安装状态');
|
||||
$this->info('panel writePluginUnInstall {slug} 移除插件安装状态');
|
||||
$this->info('panel writeMysqlPassword {password} 写入MySQL root密码');
|
||||
$this->info('panel writeSite {name} {status} {path} {php} {ssl} 写入网站数据到面板');
|
||||
$this->info('panel deleteSite {name} 删除面板网站数据');
|
||||
$this->info('panel writeSetting {name} {value} 写入/更新面板设置数据');
|
||||
$this->info('panel deleteSetting {name} 删除面板设置数据');
|
||||
break;
|
||||
}
|
||||
return CommandAlias::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @return void
|
||||
*/
|
||||
private function init(): void
|
||||
{
|
||||
Setting::query()->updateOrCreate(['name' => 'name'], ['value' => '耗子Linux面板']);
|
||||
Setting::query()->updateOrCreate(['name' => 'monitor'], ['value' => '1']);
|
||||
Setting::query()->updateOrCreate(['name' => 'monitor_days'], ['value' => '30']);
|
||||
Setting::query()->updateOrCreate(['name' => 'mysql_root_password'], ['value' => '']);
|
||||
Setting::query()->updateOrCreate(['name' => 'postgresql_root_password'], ['value' => '']);
|
||||
User::query()->create([
|
||||
'id' => 1,
|
||||
'username' => 'admin',
|
||||
'email' => 'panel@haozi.net',
|
||||
'password' => Hash::make(Str::random()),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新面板
|
||||
* @return void
|
||||
*/
|
||||
private function update(): void
|
||||
{
|
||||
/**
|
||||
* 检查当前是否有任务正在运行
|
||||
*/
|
||||
if (Task::query()->where('status', '!=', 'finished')->count()) {
|
||||
$this->error('当前有任务正在运行,请稍后再试');
|
||||
$this->info('如需强制更新,请先执行:panel cleanRunningTask');
|
||||
return;
|
||||
}
|
||||
$this->info('正在下载面板...');
|
||||
shell_exec('wget -O /tmp/panel.zip https://api.panel.haozi.xyz/api/version/latest');
|
||||
// 检查下载是否成功
|
||||
if (!file_exists('/tmp/panel.zip') || filesize('/tmp/panel.zip') < 4096) {
|
||||
$this->error('检测到面板新版本下载失败,已终止更新,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在备份数据库...');
|
||||
shell_exec('rm -rf /tmp/database.sqlite');
|
||||
if (!copy('/www/panel/database/database.sqlite', '/tmp/database.sqlite')) {
|
||||
$this->error('备份数据库失败,已终止更新,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在备份插件...');
|
||||
shell_exec('rm -rf /tmp/plugins');
|
||||
shell_exec('\cp -rf /www/panel/plugins /tmp/plugins');
|
||||
if (!is_dir('/tmp/plugins/Openresty')) {
|
||||
$this->error('检测到面板插件备份失败,已终止更新,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在删除旧版本...');
|
||||
shell_exec('rm -rf /www/panel');
|
||||
shell_exec('mkdir /www/panel');
|
||||
$this->info('正在解压新版本...');
|
||||
shell_exec('unzip -o /tmp/panel.zip -d /www/panel');
|
||||
if (!file_exists('/www/panel/artisan')) {
|
||||
$this->error('检测到面板新版本解压失败,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在恢复数据库...');
|
||||
shell_exec('rm -rf /www/panel/database/database.sqlite');
|
||||
if (!copy('/tmp/database.sqlite', '/www/panel/database/database.sqlite')) {
|
||||
$this->error('检测到面板数据库恢复失败,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在恢复插件...');
|
||||
shell_exec('rm -rf /www/panel/plugins');
|
||||
shell_exec('\cp -rf /tmp/plugins /www/panel/plugins');
|
||||
if (!is_dir('/www/panel/plugins/Openresty')) {
|
||||
$this->error('检测到面板插件恢复失败,请加QQ群:12370907 反馈处理');
|
||||
return;
|
||||
}
|
||||
$this->info('正在更新面板数据库...');
|
||||
shell_exec('cd /www/panel && php-panel artisan migrate');
|
||||
$this->info('正在设置面板权限...');
|
||||
shell_exec('chown -R root:root /www/panel');
|
||||
shell_exec('chmod -R 600 /www/panel');
|
||||
shell_exec('chmod 755 /www/panel');
|
||||
shell_exec('chmod -R 755 /www/panel/public');
|
||||
shell_exec('chown -R root:root /www/server/cron');
|
||||
shell_exec('chmod -R 700 /www/server/cron');
|
||||
shell_exec('chmod -R 600 /www/server/cron/logs');
|
||||
shell_exec('chown -R root:root /www/server/vhost');
|
||||
shell_exec('chmod -R 644 /www/server/vhost');
|
||||
$this->info('正在重载面板服务...');
|
||||
$reloadCheck = shell_exec('systemctl reload panel.service 2>&1');
|
||||
// 检查重启是否成功
|
||||
if (!empty($reloadCheck)) {
|
||||
$this->error('检测到面板服务重载失败,请加QQ群:12370907 反馈处理');
|
||||
} else {
|
||||
$this->info('正在清理临时文件...');
|
||||
shell_exec('rm -rf /tmp/panel.zip');
|
||||
shell_exec('rm -rf /tmp/database.sqlite');
|
||||
shell_exec('rm -rf /tmp/plugins');
|
||||
$this->info('面板更新成功');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取面板信息
|
||||
* @return void
|
||||
*/
|
||||
private function getInfo(): void
|
||||
{
|
||||
$user = User::query()->where('id', 1);
|
||||
// 生成唯一信息
|
||||
$username = Str::random(6);
|
||||
$password = Str::random(12);
|
||||
// 入库
|
||||
$user->update([
|
||||
'username' => $username,
|
||||
'password' => Hash::make($password),
|
||||
]);
|
||||
|
||||
// 从nginx配置文件中获取面板端口
|
||||
$nginxConf = file_get_contents('/www/server/nginx/conf/nginx.conf');
|
||||
preg_match('/listen\s+(\d+)/', $nginxConf, $matches);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
$this->info('获取面板端口失败,请检查nginx主配置文件');
|
||||
}
|
||||
|
||||
$this->info('面板用户名:'.$username);
|
||||
$this->info('面板密码:'.$password);
|
||||
$this->info('访问地址:http://IP:'.$matches[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取端口
|
||||
* @return void
|
||||
*/
|
||||
private function getPort(): void
|
||||
{
|
||||
// 从nginx配置文件中获取面板端口
|
||||
$nginxConf = file_get_contents('/www/server/nginx/conf/nginx.conf');
|
||||
preg_match('/listen\s+(\d+)/', $nginxConf, $matches);
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$this->info('面板访问端口为:'.$matches[1]);
|
||||
} else {
|
||||
$this->error('获取面板端口失败,请检查nginx主配置文件');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入插件安装状态
|
||||
* @return void
|
||||
*/
|
||||
private function writePluginInstall(): void
|
||||
{
|
||||
$pluginSlug = $this->argument('a1');
|
||||
|
||||
// 判空
|
||||
if (empty($pluginSlug)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
// 入库
|
||||
Plugin::query()->updateOrCreate(
|
||||
['slug' => $pluginSlug],
|
||||
['show' => 0]
|
||||
);
|
||||
$this->info('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入插件卸载状态
|
||||
* @return void
|
||||
*/
|
||||
private function writePluginUnInstall(): void
|
||||
{
|
||||
$pluginSlug = $this->argument('a1');
|
||||
|
||||
// 判空
|
||||
if (empty($pluginSlug)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
if ($pluginSlug == 'openresty') {
|
||||
$this->error('耗子Linux面板:请不要花样作死!');
|
||||
return;
|
||||
}
|
||||
// 入库
|
||||
Plugin::query()->where('slug', $pluginSlug)->delete();
|
||||
$this->info('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入MySQL密码
|
||||
* @return void
|
||||
*/
|
||||
private function writeMysqlPassword(): void
|
||||
{
|
||||
$password = $this->argument('a1');
|
||||
|
||||
// 判空
|
||||
if (empty($password)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
// 入库
|
||||
Setting::query()->where('name', 'mysql_root_password')->updateOrCreate([
|
||||
'name' => 'mysql_root_password',
|
||||
], [
|
||||
'value' => $password,
|
||||
]);
|
||||
$this->info('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理所有运行中和等待中的任务
|
||||
* @return void
|
||||
*/
|
||||
private function cleanRunningTask(): void
|
||||
{
|
||||
// 更新任务状态
|
||||
Task::query()->update(['status' => 'finished']);
|
||||
// 将所有队列任务清空
|
||||
shell_exec('php-panel /www/panel/artisan queue:clear');
|
||||
$this->info('成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 备份网站/MySQL数据库/PostgreSQL数据库到指定目录
|
||||
* @return void
|
||||
*/
|
||||
private function backup(): void
|
||||
{
|
||||
$type = $this->argument('a1');
|
||||
$name = $this->argument('a2');
|
||||
$path = $this->argument('a3');
|
||||
|
||||
// 判空
|
||||
if (empty($type) || empty($name) || empty($path)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断目录是否存在
|
||||
if (!is_dir($path)) {
|
||||
$this->error('目录不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断目录是否可写
|
||||
if (!is_writable($path)) {
|
||||
$this->error('目录不可写');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断备份目录是否以/结尾,有则去掉
|
||||
if (str_ends_with($path, '/')) {
|
||||
$path = substr($path, 0, -1);
|
||||
}
|
||||
|
||||
// 判断类型
|
||||
if ($type == 'website') {
|
||||
// 备份网站
|
||||
// 从数据库中获取网站目录
|
||||
$sitePath = Website::query()->where('name', $name)->value('path');
|
||||
if (empty($sitePath)) {
|
||||
$this->error('网站不存在');
|
||||
return;
|
||||
}
|
||||
$backupFile = $path.'/'.$name.'_'.date('YmdHis').'.zip';
|
||||
shell_exec('zip -r '.$backupFile.' '.escapeshellarg($sitePath).' 2>&1');
|
||||
$this->info('成功');
|
||||
} elseif ($type == 'mysql') {
|
||||
// 备份MySQL数据库
|
||||
$password = Setting::query()->where('name', 'mysql_root_password')->value('value');
|
||||
$backupFile = $path.'/'.$name.'_'.date('YmdHis').'.sql.zip';
|
||||
$tempFile = $name.'_'.date('YmdHis').'.sql';
|
||||
// 判断数据库是否存在
|
||||
$name = escapeshellarg($name);
|
||||
$check = shell_exec("mysql -u root -p".$password." -e 'use ".$name."' 2>&1");
|
||||
if (str_contains($check, 'ERROR')) {
|
||||
$this->error('数据库不存在');
|
||||
return;
|
||||
}
|
||||
// 傻逼MySQL,瞎jb输出警告
|
||||
//shell_exec("mysqldump -u root -p".$password." ".$name." 2> /dev/null > /tmp/".$tempFile);
|
||||
putenv('MYSQL_PWD='.$password);
|
||||
shell_exec("mysqldump -u root ".$name." > /tmp/".$tempFile);
|
||||
// zip压缩
|
||||
shell_exec('cd /tmp && zip -r '.$tempFile.'.zip '.escapeshellarg($tempFile).' 2>&1');
|
||||
// 移动文件
|
||||
if (file_exists($backupFile)) {
|
||||
$this->error('检测到备份已存在,已跳过此次备份');
|
||||
unlink('/tmp/'.$tempFile);
|
||||
return;
|
||||
}
|
||||
rename('/tmp/'.$tempFile.'.zip', $backupFile);
|
||||
// 删除临时文件
|
||||
unlink('/tmp/'.$tempFile);
|
||||
$this->info('成功');
|
||||
} elseif ($type == 'postgresql') {
|
||||
// 备份PostgreSQL数据库
|
||||
$backupFile = $path.'/'.$name.'_'.date('YmdHis').'.sql.zip';
|
||||
$tempFile = $name.'_'.date('YmdHis').'.sql';
|
||||
// 判断数据库是否存在
|
||||
$check = shell_exec('su - postgres -c "psql -l" 2>&1');
|
||||
if (!str_contains($check, $name)) {
|
||||
$this->error('数据库不存在');
|
||||
return;
|
||||
}
|
||||
$name = escapeshellarg($name);
|
||||
shell_exec('su - postgres -c "pg_dump '.$name.'" > /tmp/'.$tempFile.' 2>&1');
|
||||
// zip压缩
|
||||
shell_exec('cd /tmp && zip -r '.$tempFile.'.zip '.escapeshellarg($tempFile).' 2>&1');
|
||||
// 移动文件
|
||||
if (file_exists($backupFile)) {
|
||||
$this->error('检测到备份已存在,已跳过此次备份');
|
||||
unlink('/tmp/'.$tempFile);
|
||||
return;
|
||||
}
|
||||
rename('/tmp/'.$tempFile.'.zip', $backupFile);
|
||||
// 删除临时文件
|
||||
unlink('/tmp/'.$tempFile);
|
||||
$this->info('成功');
|
||||
} else {
|
||||
$this->error('参数错误');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入网站数据到面板
|
||||
* @return void
|
||||
*/
|
||||
private function writeSite(): void
|
||||
{
|
||||
$name = $this->argument('a1');
|
||||
$status = $this->argument('a2');
|
||||
$path = $this->argument('a3');
|
||||
$php = $this->argument('a4');
|
||||
$ssl = $this->argument('a5');
|
||||
|
||||
// 判空
|
||||
if (empty($name) || empty($status) || empty($path) || empty($php) || empty($ssl)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断网站是否存在
|
||||
if (Website::query()->where('name', $name)->exists()) {
|
||||
$this->error('网站已存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断目录是否存在
|
||||
if (!is_dir($path)) {
|
||||
$this->error('目录不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 写入网站
|
||||
Website::query()->create([
|
||||
'name' => $name,
|
||||
'status' => $status,
|
||||
'path' => $path,
|
||||
'php' => $php,
|
||||
'ssl' => $ssl,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除面板网站数据
|
||||
* @return void
|
||||
*/
|
||||
private function deleteSite(): void
|
||||
{
|
||||
$name = $this->argument('a1');
|
||||
|
||||
// 判空
|
||||
if (empty($name)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断网站是否存在
|
||||
if (!Website::query()->where('name', $name)->exists()) {
|
||||
$this->error('网站不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除网站
|
||||
Website::query()->where('name', $name)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入/更新面板设置数据
|
||||
* @return void
|
||||
*/
|
||||
private function writeSetting(): void
|
||||
{
|
||||
$name = $this->argument('a1');
|
||||
$value = $this->argument('a2');
|
||||
|
||||
// 判空
|
||||
if (empty($name) || empty($value)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
Setting::query()->updateOrCreate(['name' => $name], ['value' => $value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除面板设置数据
|
||||
* @return void
|
||||
*/
|
||||
private function deleteSetting(): void
|
||||
{
|
||||
$name = $this->argument('a1');
|
||||
|
||||
// 判空
|
||||
if (empty($name)) {
|
||||
$this->error('参数错误');
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断设置是否存在
|
||||
if (!Setting::query()->where('name', $name)->exists()) {
|
||||
$this->error('设置不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除设置
|
||||
Setting::query()->where('name', $name)->delete();
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use App\Models\Cron;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('monitor')->everyMinute();
|
||||
// 查询所有计划任务
|
||||
$crons = Cron::all();
|
||||
foreach ($crons as $cron) {
|
||||
$file = '/www/server/cron/'.$cron->shell;
|
||||
// 检查文件是否存在,及所有者是否为root
|
||||
if (!file_exists($file) || fileowner($file) != 0) {
|
||||
file_put_contents('/www/server/cron/logs/'.$cron->id.'.log',
|
||||
PHP_EOL.'耗子Linux面板:检测到脚本文件异常,为确保安全已终止运行,如果你不知道发生了什么,这通常意味着服务器已被入侵。'.PHP_EOL,
|
||||
FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
$schedule->exec('bash '.escapeshellarg($file))->withoutOverlapping()->cron($cron->time)->appendOutputTo('/www/server/cron/logs/'.$cron->id.'.log')->when(function (
|
||||
) use ($cron) {
|
||||
return (boolean) $cron->status;
|
||||
})->after(function () use ($cron) {
|
||||
$cron->updated_at = now();
|
||||
$cron->save();
|
||||
})->onSuccess(function () use ($cron) {
|
||||
file_put_contents('/www/server/cron/logs/'.$cron->id.'.log',
|
||||
PHP_EOL.Carbon::now()->toDateTimeString().' 任务执行成功'.PHP_EOL, FILE_APPEND);
|
||||
})->onFailure(function () use ($cron) {
|
||||
file_put_contents('/www/server/cron/logs/'.$cron->id.'.log',
|
||||
PHP_EOL.Carbon::now()->toDateTimeString().' 任务执行失败'.PHP_EOL, FILE_APPEND);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of exception types with their corresponding custom log levels.
|
||||
*
|
||||
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
||||
*/
|
||||
protected $levels = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<\Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 计划任务控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Cron;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CronsController extends Controller
|
||||
{
|
||||
/**
|
||||
* 面板计划任务列表
|
||||
*/
|
||||
public function getList(Request $request): JsonResponse
|
||||
{
|
||||
$limit = $request->input('limit', 10);
|
||||
|
||||
$crons = Cron::query()->orderBy('id', 'desc')->paginate($limit);
|
||||
$cronData = [];
|
||||
|
||||
foreach ($crons as $k => $v) {
|
||||
// 格式化时间
|
||||
$cronData[$k]['id'] = $v['id'];
|
||||
$cronData[$k]['name'] = $v['name'];
|
||||
$cronData[$k]['status'] = $v['status'];
|
||||
$cronData[$k]['type'] = $v['type'];
|
||||
$cronData[$k]['time'] = $v['time'];
|
||||
$cronData[$k]['shell'] = $v['shell'];
|
||||
$cronData[$k]['script'] = @file_get_contents('/www/server/cron/'.$v['shell']);
|
||||
$cronData[$k]['created_at'] = Carbon::create($v['created_at'])->toDateTimeString();
|
||||
$cronData[$k]['updated_at'] = Carbon::create($v['updated_at'])->toDateTimeString();
|
||||
}
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
$data['count'] = $crons->total();
|
||||
$data['data'] = $cronData;
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加计划任务
|
||||
*/
|
||||
public function add(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'name' => 'required|max:255',
|
||||
'time' => [
|
||||
'required',
|
||||
'regex:/^((\*|\d+|\d+-\d+|\d+\/\d+|\d+-\d+\/\d+|\*\/\d+)(\,(\*|\d+|\d+-\d+|\d+\/\d+|\d+-\d+\/\d+|\*\/\d+))*\s?){5}$/'
|
||||
],
|
||||
'script' => 'required',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
// 将script写入shell文件
|
||||
$shellDir = '/www/server/cron/';
|
||||
$shellLogDir = '/www/server/cron/logs/';
|
||||
if (!is_dir($shellDir)) {
|
||||
mkdir($shellDir, 700, true);
|
||||
}
|
||||
if (!is_dir($shellLogDir)) {
|
||||
mkdir($shellLogDir, 600, true);
|
||||
}
|
||||
$shellFile = uniqid().'.sh';
|
||||
file_put_contents($shellDir.$shellFile, $credentials['script']);
|
||||
|
||||
$cron = new Cron();
|
||||
$cron->name = $credentials['name'];
|
||||
$cron->status = 1;
|
||||
$cron->type = '脚本';
|
||||
$cron->time = $credentials['time'];
|
||||
$cron->shell = $shellFile;
|
||||
$cron->save();
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计划任务
|
||||
*/
|
||||
public function edit(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'id' => 'required|integer',
|
||||
'name' => 'required|max:255',
|
||||
'time' => ['required', 'regex:/^((\*|\d+|\d+-\d+|\d+\/\d+)(\,(\*|\d+|\d+-\d+|\d+\/\d+))*\s?){5}$/'],
|
||||
'script' => 'required',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
$cron = Cron::query()->find($credentials['id']);
|
||||
$cron->name = $credentials['name'];
|
||||
$cron->time = $credentials['time'];
|
||||
// 将script写入shell文件
|
||||
$shellDir = '/www/server/cron/';
|
||||
$shellLogDir = '/www/server/cron/logs/';
|
||||
if (!is_dir($shellDir)) {
|
||||
mkdir($shellDir, 700, true);
|
||||
}
|
||||
if (!is_dir($shellLogDir)) {
|
||||
mkdir($shellLogDir, 600, true);
|
||||
}
|
||||
$shellFile = $cron->shell;
|
||||
file_put_contents($shellDir.$shellFile, $credentials['script']);
|
||||
// 将文件转为unix格式
|
||||
exec('dos2unix '.$shellDir.$shellFile);
|
||||
// 设置文件权限
|
||||
exec('chmod 700 '.$shellDir.$shellFile);
|
||||
$cron->save();
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计划任务
|
||||
*/
|
||||
public function delete(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'id' => 'required|integer',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
$cron = Cron::query()->find($credentials['id']);
|
||||
// 删除shell文件
|
||||
$shellDir = '/www/server/cron/';
|
||||
$shellFile = $cron->shell;
|
||||
@unlink($shellDir.$shellFile);
|
||||
// 删除日志文件
|
||||
$shellLogDir = '/www/server/cron/logs/';
|
||||
$shellLogFile = $shellFile.'.log';
|
||||
@unlink($shellLogDir.$shellLogFile);
|
||||
$cron->delete();
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计划任务状态
|
||||
*/
|
||||
public function setStatus(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'id' => 'required|integer',
|
||||
'status' => 'required|integer',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
$cron = Cron::query()->find($credentials['id']);
|
||||
$cron->status = $credentials['status'];
|
||||
$cron->save();
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取计划任务日志
|
||||
*/
|
||||
public function getLog(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'id' => 'required|integer',
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
$log = @file_get_contents('/www/server/cron/logs/'.$credentials['id'].'.log');
|
||||
if ($log === false) {
|
||||
$log = '暂无日志';
|
||||
}
|
||||
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
$data['data'] = htmlspecialchars($log);
|
||||
return response()->json($data);
|
||||
}
|
||||
}
|
||||
@@ -1,504 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 文件控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class FilesController extends Controller
|
||||
{
|
||||
/**
|
||||
* 获取某个目录下的文件(夹)列表
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getList(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'limit' => 'required|integer',
|
||||
'page' => 'required|integer',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$limit = $credentials['limit'];
|
||||
$page = $credentials['page'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目录不存在']);
|
||||
}
|
||||
|
||||
$files = scandir($path);
|
||||
$fileData = [];
|
||||
foreach ($files as $k => $v) {
|
||||
if ($v == '.' || $v == '..') {
|
||||
continue;
|
||||
}
|
||||
$fileData[$k]['name'] = $v;
|
||||
$fileData[$k]['path'] = $path.'/'.$v;
|
||||
$fileData[$k]['type'] = filetype($path.'/'.$v);
|
||||
$fileData[$k]['size'] = filesize($path.'/'.$v);
|
||||
$fileData[$k]['mtime'] = Carbon::createFromTimestamp(filemtime($path.'/'.$v))->toDateTimeString();
|
||||
}
|
||||
|
||||
// 分页
|
||||
|
||||
$total = count($fileData);
|
||||
$filesArr = array_slice($fileData, ($page - 1) * $limit, $limit);
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
$data['count'] = $total;
|
||||
$data['data'] = $filesArr;
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件内容
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getFileContent(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'file' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$file = $credentials['file'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($file)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件不存在']);
|
||||
}
|
||||
|
||||
$content = @file_get_contents($file);
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
$data['data'] = $content;
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件内容
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function saveFileContent(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'file' => ['required', 'regex:/^\/.*$/'],
|
||||
'content' => 'required',
|
||||
]);
|
||||
$file = $credentials['file'];
|
||||
$content = $credentials['content'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($file)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件不存在']);
|
||||
}
|
||||
|
||||
$res = @file_put_contents($file, $content);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '保存失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function createDir(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'name' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$name = $credentials['name'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目录不存在']);
|
||||
}
|
||||
|
||||
$res = @mkdir($path.'/'.$name);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '创建失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件或目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function rename(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'name' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$name = $credentials['name'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$res = @rename($path, dirname($path).'/'.$name);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '重命名失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function uploadFile(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'file' => 'required|file',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$file = $credentials['file'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目录不存在']);
|
||||
}
|
||||
|
||||
$res = @move_uploaded_file($file->getRealPath(), $path.'/'.$file->getClientOriginalName());
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '上传失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param Request $request
|
||||
* @return JsonResponse|BinaryFileResponse
|
||||
*/
|
||||
public function downloadFile(Request $request): BinaryFileResponse|JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件不存在']);
|
||||
}
|
||||
|
||||
return response()->download($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
*/
|
||||
public function createFile(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'name' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$name = $credentials['name'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目录不存在']);
|
||||
}
|
||||
|
||||
$res = @file_put_contents($path.'/'.$name, '');
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '创建失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置权限
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function chmod(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'mode' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$mode = $credentials['mode'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$res = @chmod($path, $mode);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '设置失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置所有者
|
||||
*/
|
||||
public function chown(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'user' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$user = $credentials['user'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$res = @chown($path, $user);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '设置失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置所有者组
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function chgrp(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'group' => 'required',
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$group = $credentials['group'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$res = @chgrp($path, $group);
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '设置失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文件/目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function copy(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'dest' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$dest = $credentials['dest'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
if (!is_dir($dest)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目标目录不存在']);
|
||||
}
|
||||
|
||||
$res = @copy($path, $dest.'/'.basename($path));
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '复制失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件/目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function move(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
'dest' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
$dest = $credentials['dest'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
if (!is_dir($dest)) {
|
||||
return response()->json(['code' => 1, 'msg' => '目标目录不存在']);
|
||||
}
|
||||
|
||||
$res = @rename($path, $dest.'/'.basename($path));
|
||||
if ($res === false) {
|
||||
return response()->json(['code' => 1, 'msg' => '移动失败']);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件/目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$res = @shell_exec('rm -rf '.escapeshellarg($path).' 2>&1');
|
||||
if (!empty($res)) {
|
||||
return response()->json(['code' => 1, 'msg' => '删除失败:'.$res]);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩文件/目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function zip(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path) && !is_dir($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件或目录不存在']);
|
||||
}
|
||||
|
||||
$zipPath = dirname($path).'/'.basename($path).'.zip';
|
||||
$res = @shell_exec('zip -r '.escapeshellarg($zipPath).' '.escapeshellarg($path).' 2>&1');
|
||||
if (!empty($res)) {
|
||||
return response()->json(['code' => 1, 'msg' => '压缩失败:'.$res]);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压文件/目录
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function unzip(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'path' => ['required', 'regex:/^\/.*$/'],
|
||||
]);
|
||||
$path = $credentials['path'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!is_file($path)) {
|
||||
return response()->json(['code' => 1, 'msg' => '文件不存在']);
|
||||
}
|
||||
|
||||
$res = @shell_exec('unzip -o '.escapeshellarg($path).' -d '.escapeshellarg(dirname($path)).' 2>&1');
|
||||
if (!empty($res)) {
|
||||
return response()->json(['code' => 1, 'msg' => '解压失败:'.$res]);
|
||||
}
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => 'success']);
|
||||
}
|
||||
}
|
||||
@@ -1,326 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 信息控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Plugin;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class InfosController extends Controller
|
||||
{
|
||||
public function getMenu(): JsonResponse
|
||||
{
|
||||
$menu = array(
|
||||
"code" => 0,
|
||||
"msg" => "",
|
||||
"data" => array(
|
||||
array(
|
||||
"name" => "home",
|
||||
"title" => "主页",
|
||||
"icon" => "layui-icon-home",
|
||||
"jump" => "/"
|
||||
),
|
||||
array(
|
||||
"name" => "website",
|
||||
"title" => "网站管理",
|
||||
"icon" => "layui-icon-website",
|
||||
"jump" => "website/list"
|
||||
),
|
||||
array(
|
||||
"name" => "monitor",
|
||||
"title" => "资源监控",
|
||||
"icon" => "layui-icon-chart-screen",
|
||||
"jump" => "monitor"
|
||||
),
|
||||
array(
|
||||
"name" => "safe",
|
||||
"title" => "系统安全",
|
||||
"icon" => "layui-icon-auz",
|
||||
"jump" => "safe"
|
||||
),
|
||||
array(
|
||||
"name" => "file",
|
||||
"title" => "文件管理",
|
||||
"icon" => "layui-icon-file",
|
||||
"jump" => "file"
|
||||
),
|
||||
array(
|
||||
"name" => "cron",
|
||||
"title" => "计划任务",
|
||||
"icon" => "layui-icon-date",
|
||||
"jump" => "cron"
|
||||
),
|
||||
array(
|
||||
"name" => "plugin",
|
||||
"title" => "插件中心",
|
||||
"icon" => "layui-icon-app",
|
||||
"jump" => "plugin"
|
||||
),
|
||||
array(
|
||||
"name" => "setting",
|
||||
"title" => "面板设置",
|
||||
"icon" => "layui-icon-set",
|
||||
"jump" => "setting"
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return response()->json($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统资源统计
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getNowMonitor(): JsonResponse
|
||||
{
|
||||
// 第一次获取网络信息
|
||||
$netInfo1 = getNetInfo();
|
||||
// 卡它一秒钟
|
||||
sleep(1);
|
||||
// 第二次获取网络信息
|
||||
$netInfo2 = getNetInfo();
|
||||
|
||||
// CPU统计信息及负载
|
||||
$cpuInfoRaw = file_get_contents('/proc/cpuinfo');
|
||||
$physicalArr = array();
|
||||
$physicalSum = 0;
|
||||
$coresSum = 0;
|
||||
$siblingsSum = 0;
|
||||
preg_match("/model name\s*:\s(.*)/", $cpuInfoRaw, $cpuName);
|
||||
preg_match("/vendor_id\s*:\s(.*)/", $cpuInfoRaw, $cpuVendor);
|
||||
preg_match("/cpu family\s*:\s(.*)/", $cpuInfoRaw, $cpuFamily);
|
||||
preg_match("/cpu MHz\s*:\s(.*)/", $cpuInfoRaw, $cpuFreq);
|
||||
preg_match("/cache size\s*:\s(.*)/", $cpuInfoRaw, $cpuCache);
|
||||
preg_match("/(\d+\.\d+), (\d+\.\d+), (\d+\.\d+)/", exec('uptime'), $uptime);
|
||||
$cpuName = $cpuName[1] ?? 'No';
|
||||
$cpuVendor = $cpuVendor[1] ?? 'No';
|
||||
$cpuFamily = $cpuFamily[1] ?? 'No';
|
||||
$cpuFreq = isset($cpuFreq[1]) ? round($cpuFreq[1], 2) : 'No';
|
||||
$cpuCache = $cpuCache[1] ?? 'No';
|
||||
$uptime1 = $uptime[1] ?? 0;
|
||||
$uptime5 = $uptime[2] ?? 0;
|
||||
$uptime15 = $uptime[3] ?? 0;
|
||||
|
||||
$processorArr = explode("\nprocessor", $cpuInfoRaw);
|
||||
foreach ($processorArr as $v) {
|
||||
preg_match("/physical id\s*:\s(.*)/", $v, $physical);
|
||||
preg_match("/cpu cores\s*:\s(.*)/", $v, $cores);
|
||||
preg_match("/siblings\s*:\s(.*)/", $v, $siblings);
|
||||
if (isset($physical[1])) {
|
||||
if (!in_array($physical[1], $physicalArr)) {
|
||||
$physicalSum += 1;
|
||||
if (isset($cores[1])) {
|
||||
$coresSum += $cores[1];
|
||||
}
|
||||
|
||||
if (isset($siblings[1])) {
|
||||
$siblingsSum += $siblings[1];
|
||||
}
|
||||
}
|
||||
$physicalArr[] = $physical[1];
|
||||
}
|
||||
}
|
||||
|
||||
// CPU使用率
|
||||
$cpuUse = 0.1;
|
||||
$cpuRaw = explode("\n", shell_exec('ps aux'));
|
||||
// 弹出第一项和最后一项
|
||||
array_pop($cpuRaw);
|
||||
array_shift($cpuRaw);
|
||||
// 获取当前php进程的pid
|
||||
$pid = getmypid();
|
||||
foreach ($cpuRaw as $v) {
|
||||
$v = preg_replace("/\s+/", " ", $v);
|
||||
$v = (explode(' ', $v));
|
||||
// 排除当前进程
|
||||
if ($v[1] == $pid) {
|
||||
continue;
|
||||
}
|
||||
$cpuUse += isset($v[2]) ? (float) $v[2] : 0;
|
||||
}
|
||||
$cpuUse = $siblingsSum > 0 ? ($cpuUse / $siblingsSum) : $cpuUse;
|
||||
$cpuUse = round($cpuUse, 2);
|
||||
$cpuUse = $cpuUse > 100 ? 100 .'%' : $cpuUse.'%';
|
||||
|
||||
// 内存使用率
|
||||
$memRaw = explode("\n", shell_exec('free -m'));
|
||||
foreach ($memRaw as $v) {
|
||||
if (str_contains($v, 'Mem')) {
|
||||
$memList = preg_replace("/\s+/", " ", $v);
|
||||
}
|
||||
}
|
||||
$memArr = explode(' ', $memList);
|
||||
// 内存大小MB
|
||||
$memTotal = $memArr[1];
|
||||
// 使用中MB
|
||||
$memUse = (str_contains($memRaw[0], 'buff/cache')) ? $memArr[2] : ($memArr[2] - $memArr[5] - $memArr[6]);
|
||||
// 使用中%
|
||||
$memUseP = round($memUse / $memTotal, 2) * 100 .'%';
|
||||
// 1分钟负载%
|
||||
$uptime1P = $uptime1 * 10;
|
||||
$uptime1P = $uptime1P > 100 ? 100 .'%' : $uptime1P.'%';
|
||||
// 5分钟负载%
|
||||
$uptime5P = $uptime5 * 10;
|
||||
$uptime5P = $uptime5P > 100 ? 100 .'%' : $uptime5P.'%';
|
||||
// 15分钟负载%
|
||||
$uptime15P = $uptime15 * 10;
|
||||
$uptime15P = $uptime15P > 100 ? 100 .'%' : $uptime15P.'%';
|
||||
|
||||
// 构建返回数组
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = [
|
||||
'cpu_use' => $cpuUse,
|
||||
'uptime_1' => $uptime1,
|
||||
'uptime_1_p' => $uptime1P,
|
||||
'uptime_5' => $uptime5,
|
||||
'uptime_5_p' => $uptime5P,
|
||||
'uptime_15' => $uptime15,
|
||||
'uptime_15_p' => $uptime15P,
|
||||
'mem_total' => $memTotal,
|
||||
'mem_use' => $memUse,
|
||||
'mem_use_p' => $memUseP,
|
||||
'tx_total' => formatBytes($netInfo1['tx']),
|
||||
'rx_total' => formatBytes($netInfo1['rx']),
|
||||
'tx_now' => formatBytes($netInfo2['tx'] - $netInfo1['tx']),
|
||||
'rx_now' => formatBytes($netInfo2['rx'] - $netInfo1['rx']),
|
||||
'cpu_info' => [
|
||||
'name' => $cpuName,
|
||||
'cores' => $coresSum,
|
||||
'physical' => $physicalSum,
|
||||
'siblings' => $siblingsSum,
|
||||
'vendor' => $cpuVendor,
|
||||
'family' => $cpuFamily,
|
||||
'freq' => $cpuFreq,
|
||||
'cache' => $cpuCache,
|
||||
],
|
||||
];
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统信息
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getSystemInfo(): JsonResponse
|
||||
{
|
||||
$os_name = file_get_contents('/etc/redhat-release');
|
||||
$uptime = file_get_contents('/proc/uptime');
|
||||
$uptime = explode(' ', $uptime)[0];
|
||||
$uptime = round($uptime / 86400, 1);
|
||||
$panel_version = config('panel.version');
|
||||
// 构建返回数组
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = [
|
||||
'os_name' => $os_name,
|
||||
'uptime' => $uptime,
|
||||
'panel_version' => $panel_version,
|
||||
];
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页插件列表
|
||||
*/
|
||||
public function getHomePlugins(): JsonResponse
|
||||
{
|
||||
$plugins = Plugin::query()->where('show', 1)->get();
|
||||
// 判空
|
||||
if ($plugins->isEmpty()) {
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = [];
|
||||
} else {
|
||||
$plugins = $plugins->toArray();
|
||||
$plugins = array_map(function ($item) {
|
||||
$item['name'] = PLUGINS[$item['slug']]['name'];
|
||||
return $item;
|
||||
}, $plugins);
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $plugins;
|
||||
}
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已安装的数据库和PHP版本
|
||||
*/
|
||||
public function getInstalledDbAndPhp(): JsonResponse
|
||||
{
|
||||
$dbVersions = [];
|
||||
// 判断mysql插件是否安装
|
||||
if (isset(PLUGINS['mysql'])) {
|
||||
$dbVersions['mysql'] = PLUGINS['mysql']['version'];
|
||||
} else {
|
||||
$dbVersions['mysql'] = false;
|
||||
}
|
||||
// 判断postgresql插件是否安装
|
||||
if (isset(PLUGINS['postgresql'])) {
|
||||
$dbVersions['postgresql'] = PLUGINS['postgresql']['version'];
|
||||
} else {
|
||||
$dbVersions['postgresql'] = false;
|
||||
}
|
||||
// 循环获取已安装的PHP版本
|
||||
$php_versions = Plugin::query()->where('slug', 'like', 'php%')->get();
|
||||
$php_versions = $php_versions->toArray();
|
||||
$php_versions = array_column($php_versions, 'slug');
|
||||
$php_versions = array_map(function ($item) {
|
||||
return str_replace('php', '', $item);
|
||||
}, $php_versions);
|
||||
|
||||
$php_version = shell_exec('ls /www/server/php');
|
||||
$php_version = trim($php_version);
|
||||
|
||||
if (!empty($php_version)) {
|
||||
$php_versions = explode("\n", $php_version);
|
||||
}
|
||||
$php_versions[] = '00';
|
||||
unset($php_versions[array_search('panel', $php_versions)]);
|
||||
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = array(
|
||||
'db_version' => $dbVersions,
|
||||
'php_version' => $php_versions
|
||||
);
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查更新
|
||||
*/
|
||||
public function checkUpdate(): JsonResponse
|
||||
{
|
||||
$version = config('panel.version');
|
||||
$remoteVersion = Http::get('https://api.panel.haozi.xyz/api/version/info')->json();
|
||||
|
||||
if ($remoteVersion['code'] != 0) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '获取远程版本信息失败';
|
||||
$res['data'] = [];
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if (version_compare($version, $remoteVersion['data']['version'], '<')) {
|
||||
$res['data'] = [
|
||||
'version' => $remoteVersion['data']['version'],
|
||||
'describe' => $remoteVersion['data']['describe'],
|
||||
];
|
||||
} else {
|
||||
$res['data'] = [];
|
||||
}
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 监控控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Monitor;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MonitorsController extends Controller
|
||||
{
|
||||
/**
|
||||
* 修改监控开关
|
||||
*/
|
||||
public function setMonitorSwitch(Request $request): JsonResponse
|
||||
{
|
||||
$switch = $request->input('switch');
|
||||
if ($switch) {
|
||||
$status = true;
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
Setting::query()->where('name', 'monitor')->update(['value' => $status]);
|
||||
return response()->json(['code' => 0, 'msg' => '修改成功']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存天数
|
||||
*/
|
||||
public function setMonitorSaveDays(Request $request): JsonResponse
|
||||
{
|
||||
$days = $request->input('days');
|
||||
Setting::query()->where('name', 'monitor_days')->update(['value' => $days]);
|
||||
return response()->json(['code' => 0, 'msg' => '修改成功']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空监控数据
|
||||
*/
|
||||
public function clearMonitorData(): JsonResponse
|
||||
{
|
||||
Monitor::query()->truncate();
|
||||
return response()->json(['code' => 0, 'msg' => '清空成功']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控开关和保存天数
|
||||
*/
|
||||
public function getMonitorSwitchAndDays(): JsonResponse
|
||||
{
|
||||
$monitor = Setting::query()->where('name', 'monitor')->first();
|
||||
$monitor_days = Setting::query()->where('name', 'monitor_days')->first();
|
||||
return response()->json([
|
||||
'code' => 0, 'msg' => '获取成功',
|
||||
'data' => ['monitor' => $monitor->value, 'monitor_days' => $monitor_days->value]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控数据
|
||||
*/
|
||||
public function getMonitorData(Request $request): JsonResponse
|
||||
{
|
||||
$start = $request->input('start') ?? now();
|
||||
$end = $request->input('end') ?? now();
|
||||
$start = Carbon::create($start);
|
||||
$end = Carbon::create($end);
|
||||
$data = Monitor::query()->where('created_at', '>=', $start)->where('created_at', '<=', $end)->get()->toArray();
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if (empty($data)) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '暂无数据';
|
||||
return response()->json($res);
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
$info = json_decode($value['info'], true);
|
||||
$res['data']['times'][] = Carbon::create($value['created_at'])->tz(config('app.timezone',
|
||||
'PRC'))->isoFormat('MM-DD HH:mm');
|
||||
$res['data']['uptime']['uptime'][] = round($info['uptime'], 2);
|
||||
$res['data']['cpu']['use'][] = round($info['cpu_use'], 2);
|
||||
$res['data']['memory']['mem_use'][] = round($info['mem_use'], 2);
|
||||
$res['data']['memory']['mem_use_p'][] = round($info['mem_use_p'], 2);
|
||||
$res['data']['memory']['swap_use'][] = round($info['swap_use'], 2);
|
||||
$res['data']['memory']['swap_use_p'][] = round($info['swap_use_p'], 2);
|
||||
$res['data']['network']['tx_now'][] = round($info['tx_now'] / 1024, 2);
|
||||
$res['data']['network']['rx_now'][] = round($info['rx_now'] / 1024, 2);
|
||||
}
|
||||
// 插入总内存大小
|
||||
$result = explode("\n", shell_exec('free -m'));
|
||||
foreach ($result as $key => $val) {
|
||||
if (str_contains($val, 'Mem')) {
|
||||
$mem_list = preg_replace("/\s+/", " ", $val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$mem_arr = explode(' ', $mem_list);
|
||||
// 内存大小MB
|
||||
$mem_total = $mem_arr[1];
|
||||
$res['data']['mem_total'] = round($mem_total, 2);
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 插件控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Jobs\ProcessShell;
|
||||
use App\Models\Plugin;
|
||||
use App\Models\Task;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
|
||||
class PluginsController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 面板插件列表
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getList(): JsonResponse
|
||||
{
|
||||
$data['code'] = 0;
|
||||
$data['msg'] = 'success';
|
||||
$data['data'] = $this->pluginList();
|
||||
// 获取首页显示状态
|
||||
$shows = Plugin::query()->pluck('show', 'slug');
|
||||
foreach ($data['data'] as $k => $v) {
|
||||
// 如果本地已安装,则显示本地名称
|
||||
$data['data'][$k]['name'] = PLUGINS[$v['slug']]['name'] ?? $data['data'][$k]['name'] ?? '无名';
|
||||
// 作者名称
|
||||
$data['data'][$k]['author'] = PLUGINS[$v['slug']]['author'] ?? $data['data'][$k]['author'] ?? '耗子';
|
||||
// 已装版本
|
||||
$data['data'][$k]['install_version'] = PLUGINS[$v['slug']]['version'] ?? '';
|
||||
// 首页显示
|
||||
$data['data'][$k]['show'] = $shows[$v['slug']] ?? 0;
|
||||
// 去除不需要的字段
|
||||
unset($data['data'][$k]['url']);
|
||||
unset($data['data'][$k]['install']);
|
||||
unset($data['data'][$k]['uninstall']);
|
||||
unset($data['data'][$k]['update']);
|
||||
if (isset(PLUGINS[$v['slug']])) {
|
||||
$data['data'][$k]['control']['installed'] = true;
|
||||
$data['data'][$k]['control']['allow_uninstall'] = true;
|
||||
// 判断是否有更新
|
||||
$data['data'][$k]['control']['update'] = version_compare($v['version'],
|
||||
$data['data'][$k]['install_version'], '>');
|
||||
if ($v['slug'] == 'openresty') {
|
||||
$data['data'][$k]['control']['allow_uninstall'] = false;
|
||||
}
|
||||
} else {
|
||||
$data['data'][$k]['control']['installed'] = false;
|
||||
$data['data'][$k]['control']['allow_uninstall'] = false;
|
||||
}
|
||||
}
|
||||
// 插入本地插件数据
|
||||
$slugs = array_column($data['data'], 'slug');
|
||||
foreach (PLUGINS as $v) {
|
||||
// 如果本地已安装,则不显示
|
||||
if (in_array($v['slug'], $slugs)) {
|
||||
continue;
|
||||
}
|
||||
// 插入插件数据
|
||||
$data['data'][] = [
|
||||
'name' => $v['name'],
|
||||
'author' => $v['author'],
|
||||
'slug' => $v['slug'],
|
||||
'version' => $v['version'],
|
||||
'install_version' => $v['version'],
|
||||
'describe' => $v['describe'],
|
||||
'show' => $shows[$v['slug']] ?? 0,
|
||||
'control' => [
|
||||
'installed' => true,
|
||||
'allow_uninstall' => false,
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安装插件
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function install(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'slug' => 'required|max:255',
|
||||
]);
|
||||
$slug = $credentials['slug'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
// 通过slug获取插件信息
|
||||
$pluginList = $this->pluginList();
|
||||
// 循环插件列表查找对应的插件信息
|
||||
$pluginCheck = false;
|
||||
$pluginData = [];
|
||||
foreach ($pluginList as $v) {
|
||||
if ($v['slug'] == $slug) {
|
||||
$pluginData = $v;
|
||||
$pluginCheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断插件是否存在
|
||||
if (!$pluginCheck) {
|
||||
return response()->json(['code' => 1, 'msg' => '插件不存在']);
|
||||
}
|
||||
|
||||
// 判断插件是否已经安装
|
||||
$installed = isset(PLUGINS[$slug]);
|
||||
if ($installed) {
|
||||
$data['code'] = 1;
|
||||
$data['msg'] = '请不要重复安装!';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
// 入库等待安装
|
||||
$task = new Task();
|
||||
$task->name = '安装 '.$pluginData['name'];
|
||||
$task->shell = $pluginData['install'];
|
||||
$task->status = 'waiting';
|
||||
$task->log = '/tmp/'.$pluginData['slug'].'.log';
|
||||
$task->save();
|
||||
// 塞入队列
|
||||
ProcessShell::dispatch($task->id)->delay(1);
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = '任务添加成功';
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载插件
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function uninstall(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'slug' => 'required|max:255',
|
||||
]);
|
||||
$slug = $credentials['slug'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
// 通过slug获取插件信息
|
||||
$pluginList = $this->pluginList();
|
||||
|
||||
// 循环插件列表查找对应的插件信息
|
||||
$pluginCheck = false;
|
||||
$pluginData = [];
|
||||
foreach ($pluginList as $v) {
|
||||
if ($v['slug'] == $slug) {
|
||||
$pluginData = $v;
|
||||
$pluginCheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断插件是否存在
|
||||
if (!$pluginCheck) {
|
||||
return response()->json(['code' => 1, 'msg' => '插件不存在']);
|
||||
}
|
||||
|
||||
// 判断是否是操作openresty
|
||||
if ($slug == 'openresty') {
|
||||
$data['code'] = 1;
|
||||
$data['msg'] = '请不要花样作死!';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
// 入库等待卸载
|
||||
$task = new Task();
|
||||
$task->name = '卸载 '.$pluginData['name'];
|
||||
$task->shell = $pluginData['uninstall'];
|
||||
$task->status = 'waiting';
|
||||
$task->log = '/tmp/'.$pluginData['slug'].'.log';
|
||||
$task->save();
|
||||
// 塞入队列
|
||||
ProcessShell::dispatch($task->id)->delay(1);
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = '任务添加成功';
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新插件
|
||||
*/
|
||||
public function update(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'slug' => 'required|max:255',
|
||||
]);
|
||||
$slug = $credentials['slug'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
// 通过slug获取插件信息
|
||||
$pluginList = $this->pluginList();
|
||||
|
||||
// 循环插件列表查找对应的插件信息
|
||||
$pluginCheck = false;
|
||||
$pluginData = [];
|
||||
foreach ($pluginList as $v) {
|
||||
if ($v['slug'] == $slug) {
|
||||
$pluginData = $v;
|
||||
$pluginCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断插件是否存在
|
||||
if (!$pluginCheck) {
|
||||
return response()->json(['code' => 1, 'msg' => '插件不存在']);
|
||||
}
|
||||
|
||||
// 判断插件是否已经安装
|
||||
$installed = isset(PLUGINS[$slug]);
|
||||
if (!$installed) {
|
||||
$data['code'] = 1;
|
||||
$data['msg'] = '插件未安装!';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
// 入库等待更新
|
||||
$task = new Task();
|
||||
$task->name = '更新 '.$pluginData['name'];
|
||||
$task->shell = $pluginData['update'];
|
||||
$task->status = 'waiting';
|
||||
$task->log = '/tmp/'.$pluginData['slug'].'.log';
|
||||
$task->save();
|
||||
// 塞入队列
|
||||
ProcessShell::dispatch($task->id)->delay(1);
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = '任务添加成功';
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取插件列表
|
||||
*/
|
||||
public function pluginList($cache = true)
|
||||
{
|
||||
// 判断刷新缓存
|
||||
if (!$cache) {
|
||||
Cache::forget('pluginList');
|
||||
}
|
||||
if (!Cache::has('pluginList')) {
|
||||
return Cache::remember('pluginList', 3600, function () {
|
||||
$response = Http::get('https://api.panel.haozi.xyz/api/plugin/list');
|
||||
// 判断请求是否成功,如果不成功则抛出异常
|
||||
if ($response->failed()) {
|
||||
throw new Exception('获取插件列表失败,请求错误');
|
||||
}
|
||||
// 判断返回的JSON数据中code是否为0,如果不为0则抛出异常
|
||||
if (!$response->json('code') == 0) {
|
||||
throw new Exception('获取插件列表失败,服务器未返回正确的状态码');
|
||||
}
|
||||
|
||||
return $response->json('data');
|
||||
});
|
||||
} else {
|
||||
// 从缓存中获取access_token
|
||||
return Cache::get('pluginList');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置插件首页显示
|
||||
*/
|
||||
public function setShowHome(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'slug' => 'required|max:255',
|
||||
'show' => 'required|boolean',
|
||||
]);
|
||||
$slug = $credentials['slug'];
|
||||
$show = $credentials['show'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json(['code' => 1, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
// 判断插件是否已经安装
|
||||
$installed = isset(PLUGINS[$slug]);
|
||||
if (!$installed) {
|
||||
$data['code'] = 1;
|
||||
$data['msg'] = '插件未安装!';
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
Plugin::query()->where('slug', $slug)->updateOrInsert(
|
||||
['slug' => $slug],
|
||||
['show' => $show]
|
||||
);
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = '设置成功';
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,280 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 安全控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class SafesController extends Controller
|
||||
{
|
||||
/**
|
||||
* 获取防火墙状态
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getFirewallStatus(): JsonResponse
|
||||
{
|
||||
$firewallStatus = trim(shell_exec("systemctl status firewalld | grep Active | awk '{print $3}'"));
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if ($firewallStatus == '(running)') {
|
||||
$res['data'] = 1;
|
||||
} else {
|
||||
$res['data'] = 0;
|
||||
}
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置防火墙状态
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function setFirewallStatus(Request $request): JsonResponse
|
||||
{
|
||||
$status = $request->input('status');
|
||||
if ($status) {
|
||||
shell_exec("systemctl enable firewalld");
|
||||
shell_exec("systemctl start firewalld");
|
||||
} else {
|
||||
shell_exec("systemctl stop firewalld");
|
||||
shell_exec("systemctl disable firewalld");
|
||||
}
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SSH状态
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getSshStatus(): JsonResponse
|
||||
{
|
||||
$sshStatus = trim(shell_exec("systemctl status sshd | grep Active | awk '{print $3}'"));
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if ($sshStatus == '(running)') {
|
||||
$res['data'] = 1;
|
||||
} else {
|
||||
$res['data'] = 0;
|
||||
}
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置SSH状态
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function setSshStatus(Request $request): JsonResponse
|
||||
{
|
||||
$status = $request->input('status');
|
||||
if ($status) {
|
||||
shell_exec("systemctl enable sshd");
|
||||
shell_exec("systemctl start sshd");
|
||||
} else {
|
||||
shell_exec("systemctl stop sshd");
|
||||
shell_exec("systemctl disable sshd");
|
||||
}
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SSH端口
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getSshPort(): JsonResponse
|
||||
{
|
||||
$sshPort = trim(shell_exec("cat /etc/ssh/sshd_config | grep 'Port ' | awk '{print $2}'"));
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $sshPort;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置SSH端口
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function setSshPort(Request $request): JsonResponse
|
||||
{
|
||||
$port = $request->input('port');
|
||||
// 只能是数字
|
||||
if (!is_numeric($port)) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '端口只能是数字';
|
||||
return response()->json($res);
|
||||
}
|
||||
$oldPort = trim(shell_exec("cat /etc/ssh/sshd_config | grep 'Port ' | awk '{print $2}'"));
|
||||
shell_exec("sed -i 's/#Port ".$oldPort."/Port ".$port."/g' /etc/ssh/sshd_config");
|
||||
shell_exec("sed -i 's/Port ".$oldPort."/Port ".$port."/g' /etc/ssh/sshd_config");
|
||||
// 判断ssh是否开启
|
||||
$sshStatus = trim(shell_exec("systemctl status sshd | grep Active | awk '{print $3}'"));
|
||||
if ($sshStatus == '(running)') {
|
||||
shell_exec("systemctl restart sshd");
|
||||
}
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ping状态
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getPingStatus(): JsonResponse
|
||||
{
|
||||
$pingStatus = trim(shell_exec("firewall-cmd --query-rich-rule='rule protocol value=icmp drop' 2>&1"));
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if ($pingStatus == 'yes') {
|
||||
$res['data'] = 0;
|
||||
} else {
|
||||
$res['data'] = 1;
|
||||
}
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置ping状态
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function setPingStatus(Request $request): JsonResponse
|
||||
{
|
||||
$status = $request->input('status');
|
||||
if ($status) {
|
||||
shell_exec("firewall-cmd --permanent --remove-rich-rule='rule protocol value=icmp drop' 2>&1");
|
||||
} else {
|
||||
shell_exec("firewall-cmd --permanent --add-rich-rule='rule protocol value=icmp drop' 2>&1");
|
||||
}
|
||||
shell_exec("firewall-cmd --reload");
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取防火墙规则
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getFirewallRules(): JsonResponse
|
||||
{
|
||||
$firewallRules = trim(shell_exec("firewall-cmd --list-all 2>&1"));
|
||||
// 判断是否开启
|
||||
if (str_contains($firewallRules, 'not running')) {
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = [];
|
||||
return response()->json($res);
|
||||
}
|
||||
// 正则匹配出ports
|
||||
preg_match('/ports: (.*)/', $firewallRules, $matches);
|
||||
$rawPorts = $matches[1];
|
||||
$ports = explode(' ', $rawPorts);
|
||||
// 对ports进行分割为port=>protocol形式
|
||||
$rules = [];
|
||||
foreach ($ports as $port) {
|
||||
$rule = explode('/', $port);
|
||||
$rules[] = [
|
||||
'port' => $rule[0],
|
||||
'protocol' => $rule[1],
|
||||
];
|
||||
}
|
||||
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $rules;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加防火墙规则
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function addFirewallRule(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$input = $this->validate($request, [
|
||||
'port' => ['required','regex:/^([0-9]+)(-([0-9]+))?$/'],
|
||||
'protocol' => 'required|in:tcp,udp',
|
||||
]);
|
||||
$port = $input['port'];
|
||||
$protocol = $input['protocol'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json([
|
||||
'code' => 1,
|
||||
'msg' => '参数错误:'.$e->getMessage(),
|
||||
'errors' => $e->errors()
|
||||
], 200);
|
||||
}
|
||||
// 判断是否开启
|
||||
$firewallStatus = trim(shell_exec("firewall-cmd --state 2>&1"));
|
||||
if ($firewallStatus != 'running') {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '防火墙未开启';
|
||||
return response()->json($res);
|
||||
}
|
||||
// 清空当前规则
|
||||
shell_exec("firewall-cmd --remove-port=".$port."/".$protocol." --permanent");
|
||||
// 添加新的防火墙规则
|
||||
shell_exec("firewall-cmd --add-port=".$port."/".$protocol." --permanent");
|
||||
// 重启防火墙
|
||||
shell_exec("firewall-cmd --reload");
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除防火墙规则
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function deleteFirewallRule(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒
|
||||
try {
|
||||
$input = $this->validate($request, [
|
||||
'port' => ['required','regex:/^([0-9]+)(-([0-9]+))?$/'],
|
||||
'protocol' => 'required|in:tcp,udp',
|
||||
]);
|
||||
$port = $input['port'];
|
||||
$protocol = $input['protocol'];
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json([
|
||||
'code' => 1,
|
||||
'msg' => '参数错误:'.$e->getMessage(),
|
||||
'errors' => $e->errors()
|
||||
], 200);
|
||||
}
|
||||
// 判断是否开启
|
||||
$firewallStatus = trim(shell_exec("firewall-cmd --state 2>&1"));
|
||||
if ($firewallStatus != 'running') {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '防火墙未开启';
|
||||
return response()->json($res);
|
||||
}
|
||||
// 清空当前规则
|
||||
shell_exec("firewall-cmd --remove-port=".$port."/".$protocol." --permanent");
|
||||
// 重启防火墙
|
||||
shell_exec("firewall-cmd --reload");
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 设置控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SettingsController extends Controller
|
||||
{
|
||||
/**
|
||||
* 获取面板设置
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function get(Request $request): JsonResponse
|
||||
{
|
||||
$settings = Setting::all();
|
||||
// 隐藏字段
|
||||
$settings->makeHidden('id');
|
||||
$settings->makeHidden('created_at');
|
||||
$settings->makeHidden('updated_at');
|
||||
$settingArr = $settings->pluck('value', 'name');
|
||||
|
||||
// 从nginx配置文件中获取面板端口
|
||||
$nginxConf = file_get_contents('/www/server/nginx/conf/nginx.conf');
|
||||
preg_match('/listen\s+(\d+)/', $nginxConf, $matches);
|
||||
if (!isset($matches[1])) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '获取面板端口失败,请检查nginx主配置文件';
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
// API
|
||||
$api = 0;
|
||||
$apiToken = '';
|
||||
if (isset($settingArr['api']) && $settingArr['api'] == 1) {
|
||||
$api = 1;
|
||||
$apiToken = $settingArr['api_token'] ?? '';
|
||||
}
|
||||
|
||||
// 多设备登录
|
||||
$multiLogin = 0;
|
||||
if (isset($settingArr['multi_login']) && $settingArr['multi_login'] == 1) {
|
||||
$multiLogin = 1;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'name' => $settingArr['name'],
|
||||
'username' => $request->user()->username,
|
||||
'email' => $request->user()->email,
|
||||
'password' => '',
|
||||
'port' => $matches[1],
|
||||
'api' => $api,
|
||||
'api_token' => $apiToken,
|
||||
'multi_login' => $multiLogin,
|
||||
];
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $data;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存面板设置
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function save(Request $request): JsonResponse
|
||||
{
|
||||
// 获取前端传递过来的数据
|
||||
$settings = $request->all();
|
||||
// 将数据入库
|
||||
foreach ($settings as $key => $value) {
|
||||
if ($key == 'access_token' || $key == 'username' || $key == 'email' || $key == 'password' || $key == 'api_token' || $key == 'api' || $key == 'port') {
|
||||
continue;
|
||||
}
|
||||
// 创建或更新
|
||||
Setting::query()->updateOrCreate(['name' => $key], ['value' => $value]);
|
||||
}
|
||||
// 单独处理用户名、密码、邮箱
|
||||
if ($request->input('username') != $request->user()->username) {
|
||||
$request->user()->update(['username' => $request->input('username')]);
|
||||
}
|
||||
if ($request->input('password') != '') {
|
||||
$request->user()->update(['password' => Hash::make($request->input('password'))]);
|
||||
}
|
||||
if ($request->input('email') != $request->user()->email) {
|
||||
$request->user()->update(['email' => $request->input('email')]);
|
||||
}
|
||||
// 处理面板端口
|
||||
$port = $request->input('port');
|
||||
$nginxConf = file_get_contents('/www/server/nginx/conf/nginx.conf');
|
||||
preg_match('/listen\s+(\d+)/', $nginxConf, $matches);
|
||||
if (!isset($matches[1])) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '获取面板端口失败,请检查nginx主配置文件';
|
||||
return response()->json($res);
|
||||
}
|
||||
if ($port != $matches[1]) {
|
||||
$nginxConf = preg_replace('/listen\s+'.$matches[1].'/', 'listen '.$port, $nginxConf, 1);
|
||||
file_put_contents('/www/server/nginx/conf/nginx.conf', $nginxConf);
|
||||
// 重载nginx
|
||||
shell_exec('systemctl reload nginx');
|
||||
// 防火墙放行端口
|
||||
$port = escapeshellarg($port);
|
||||
shell_exec('firewall-cmd --permanent --zone=public --add-port='.$port.'/tcp >/dev/null 2>&1');
|
||||
shell_exec('firewall-cmd --reload');
|
||||
}
|
||||
// 处理api
|
||||
$api = $request->input('api', 0);
|
||||
$apiCheck = Setting::query()->where('name', 'api')->value('value');
|
||||
if (empty($apiCheck)) {
|
||||
$apiCheck = 0;
|
||||
}
|
||||
if ($api != $apiCheck) {
|
||||
if ($api) {
|
||||
Setting::query()->insert([
|
||||
'name' => 'api',
|
||||
'value' => 1,
|
||||
]);
|
||||
// 生成api用户
|
||||
$username = 'api_'.Str::random();
|
||||
$apiUser = User::query()->create([
|
||||
'username' => $username,
|
||||
'password' => Hash::make(Str::random()),
|
||||
'email' => 'panel_api@haozi.net',
|
||||
]);
|
||||
// 生成api token
|
||||
$apiToken = $apiUser->createToken('api')->plainTextToken;
|
||||
Setting::query()->insert([
|
||||
'name' => 'api_user',
|
||||
'value' => $username,
|
||||
]);
|
||||
Setting::query()->insert([
|
||||
'name' => 'api_token',
|
||||
'value' => $apiToken,
|
||||
]);
|
||||
} else {
|
||||
Setting::query()->where('name', 'api')->delete();
|
||||
Setting::query()->where('name', 'api_token')->delete();
|
||||
$username = Setting::query()->where('name', 'api_user')->value('value');
|
||||
Setting::query()->where('name', 'api_user')->delete();
|
||||
Setting::query()->where('name', 'api')->delete();
|
||||
$apiUser = User::query()->where('username', $username)->first();
|
||||
// 删除api用户的所有token
|
||||
$apiUser->tokens()->delete();
|
||||
// 删除api用户
|
||||
$apiUser->delete();
|
||||
}
|
||||
}
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 任务控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Task;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TasksController extends Controller
|
||||
{
|
||||
/**
|
||||
* 获取是否有进行中/未完成的任务
|
||||
* 前台会根据这个返回渲染顶部工具栏的图标
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getStatus(): JsonResponse
|
||||
{
|
||||
// 获取任务表中的等待中/进行中的任务
|
||||
$task = Task::query()->where('status', 'running')->orWhere('status', 'waiting')->first();
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if (empty($task)) {
|
||||
$res['data'] = false;
|
||||
} else {
|
||||
$res['data'] = true;
|
||||
}
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进行中的那个任务
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getListRunning(): JsonResponse
|
||||
{
|
||||
// 获取进行中的任务列表
|
||||
$task = Task::query()->where('status', 'running')->get()->toArray();
|
||||
|
||||
// 判断任务是否存在
|
||||
if (empty($task)) {
|
||||
$task[0] = "";
|
||||
}
|
||||
// 构建返回数据
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $task[0];
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等待中的任务列表
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getListWaiting(): JsonResponse
|
||||
{
|
||||
$task_list = Task::query()->where('status', 'waiting')->get()->toArray();
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
// 判断任务是否存在
|
||||
if (empty($task_list)) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '无任务!';
|
||||
}
|
||||
$res['data'] = $task_list;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已完成的任务列表
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getListFinished(): JsonResponse
|
||||
{
|
||||
$task_list = Task::query()->where('status', 'finished')->get()->toArray();
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
if (empty($task_list)) {
|
||||
$res['code'] = 1;
|
||||
$res['msg'] = '无任务!';
|
||||
}
|
||||
$res['data'] = $task_list;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个任务的log
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getTaskLog(Request $request): JsonResponse
|
||||
{
|
||||
$name = $request->get('name');
|
||||
$log_file = Task::query()->where('name', $name)->value('log');
|
||||
|
||||
$log = shell_exec('tail -n 30 '.$log_file);
|
||||
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = $log;
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function deleteTask(Request $request): JsonResponse
|
||||
{
|
||||
$name = $request->get('name');
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data'] = Task::query()->where('name', $name)->delete();
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 用户控制器
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class UsersController extends Controller
|
||||
{
|
||||
/**
|
||||
* 登录
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function login(Request $request): JsonResponse
|
||||
{
|
||||
// 消毒数据
|
||||
try {
|
||||
$credentials = $this->validate($request, [
|
||||
'username' => 'required|max:255',
|
||||
'password' => 'required|max:255',
|
||||
'remember' => 'required|boolean'
|
||||
]);
|
||||
} catch (ValidationException $e) {
|
||||
return response()->json([
|
||||
'code' => 1,
|
||||
'msg' => '参数错误:'.$e->getMessage(),
|
||||
'errors' => $e->errors()
|
||||
], 422);
|
||||
}
|
||||
if (auth()->attempt(['username' => $credentials['username'], 'password' => $credentials['password']],
|
||||
$credentials['remember'])) {
|
||||
$user = auth()->user();
|
||||
// 多设备登录
|
||||
$multiLogin = Setting::query()->where('name', 'multi_login')->value('value');
|
||||
if ($multiLogin != 1) {
|
||||
$user->tokens()->delete();
|
||||
}
|
||||
$token = $user->createToken('token')->plainTextToken;
|
||||
return response()->json(['code' => 0, 'msg' => '登录成功', 'data' => ['access_token' => $token]]);
|
||||
} else {
|
||||
return response()->json(['code' => 1, 'msg' => '登录失败,用户名或密码错误']);
|
||||
}
|
||||
}
|
||||
|
||||
public function getInfo(Request $request): JsonResponse
|
||||
{
|
||||
$user = $request->user();
|
||||
$res['code'] = 0;
|
||||
$res['msg'] = 'success';
|
||||
$res['data']['username'] = $user->username;
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\AddAccessToken::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class AddAccessToken
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*/
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
// 获取请求头中的token
|
||||
$token = $request->header('access_token') ?? $request->input('access_token');
|
||||
// 将token放入请求中
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
abort(response()->json([
|
||||
'code' => 1001,
|
||||
'msg' => '登录状态失效'
|
||||
]));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Task;
|
||||
|
||||
class ProcessShell implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* 任务最大尝试次数
|
||||
* @var int
|
||||
*/
|
||||
public int $tries = 1;
|
||||
/**
|
||||
* 任务运行的超时时间
|
||||
* @var int
|
||||
*/
|
||||
public int $timeout = 7200;
|
||||
|
||||
/**
|
||||
* 任务名
|
||||
*/
|
||||
public string $task_id;
|
||||
|
||||
/**
|
||||
* 任务脚本
|
||||
*/
|
||||
public string $shell;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($task_id)
|
||||
{
|
||||
$this->task_id = $task_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
// 检查当前是否有任务正在运行
|
||||
$taskCheck = Task::query()->where('status', 'running')->get();
|
||||
if ($taskCheck->isNotEmpty()) {
|
||||
$this->release(10);
|
||||
return;
|
||||
}
|
||||
// 查询任务
|
||||
$task = Task::query()->where('id', $this->task_id)->first();
|
||||
echo $task->name."开始执行".PHP_EOL;
|
||||
// 更新任务状态为running
|
||||
$task->job_id = $this->job->getJobId();
|
||||
$task->status = 'running';
|
||||
$task->save();
|
||||
shell_exec($task->shell);
|
||||
// 更新任务状态
|
||||
$task->status = 'finished';
|
||||
$task->save();
|
||||
echo $task->name."执行完毕".PHP_EOL;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cron extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'status',
|
||||
'type',
|
||||
'time',
|
||||
'shell',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Database extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Monitor extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = [
|
||||
'info',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Plugin extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = ['slug', 'name', 'version', 'show', 'created_at', 'updated_at'];
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = ['name', 'value', 'created_at', 'updated_at'];
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Task extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = [
|
||||
'job_id',
|
||||
'name',
|
||||
'shell',
|
||||
'log',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'password',
|
||||
'email'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
];
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Website extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// 白名单
|
||||
protected $fillable = ['name', 'status', 'path', 'php', 'ssl', 'ssl_date', 'note', 'created_at', 'updated_at'];
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use App\Services\Plugin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class PluginServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @param Plugin $plugins
|
||||
* @return void
|
||||
* @throws BindingResolutionException
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function boot(Plugin $plugins): void
|
||||
{
|
||||
|
||||
$loader = $this->app->make('translation.loader');
|
||||
// Make view instead of view.finder since the finder is defined as not a singleton
|
||||
$finder = $this->app->make('view');
|
||||
|
||||
foreach ($plugins->getPlugins() as $plugin) {
|
||||
|
||||
// 加载视图路径
|
||||
$finder->addNamespace($plugin['slug'], $plugin['path']."/views");
|
||||
|
||||
// 加载语言包
|
||||
$loader->addNamespace($plugin['slug'], $plugin['path']."/lang");
|
||||
}
|
||||
|
||||
// 加载插件Composer装载文件
|
||||
try {
|
||||
foreach ($plugins->getComposerLoaders() as $autoloader) {
|
||||
require $autoloader;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new BindingResolutionException($e->getMessage());
|
||||
}
|
||||
|
||||
// 加载插件主文件
|
||||
try {
|
||||
foreach ($plugins->getPluginMainFiles() as $file) {
|
||||
require_once $file;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw new BindingResolutionException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册插件服务
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton('plugins', Plugin::class);
|
||||
// 设置面板名称
|
||||
$name = @DB::table('settings')->where('name', 'name')->value('value');
|
||||
$this->app['config']['panel.name'] = !empty($name) ? $name : config('panel.name');
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class Plugin
|
||||
{
|
||||
/**
|
||||
* @var Application
|
||||
*/
|
||||
protected Application $app;
|
||||
|
||||
/**
|
||||
* @var Dispatcher
|
||||
*/
|
||||
protected Dispatcher $dispatcher;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected Filesystem $filesystem;
|
||||
|
||||
/**
|
||||
* @var Collection|null
|
||||
*/
|
||||
protected ?Collection $plugins;
|
||||
|
||||
public function __construct(
|
||||
Application $app,
|
||||
Dispatcher $dispatcher,
|
||||
Filesystem $filesystem,
|
||||
Collection $plugins = new Collection()
|
||||
) {
|
||||
$this->app = $app;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->filesystem = $filesystem;
|
||||
$this->plugins = $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取所有插件
|
||||
*
|
||||
* @return Collection|null
|
||||
* @throws FileNotFoundException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getPlugins(): ?Collection
|
||||
{
|
||||
if ($this->plugins->isEmpty()) {
|
||||
$plugins = new Collection();
|
||||
|
||||
$installed = [];
|
||||
|
||||
try {
|
||||
$resource = opendir($this->getPluginsDir());
|
||||
} catch (Exception $e) {
|
||||
// 输出错误信息
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
// 读取插件目录
|
||||
while ($filename = @readdir($resource)) {
|
||||
if ($filename == '.' || $filename == '..') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = $this->getPluginsDir().DIRECTORY_SEPARATOR.$filename;
|
||||
|
||||
if (is_dir($path)) {
|
||||
$pluginJsonPath = $path.DIRECTORY_SEPARATOR.'plugin.json';
|
||||
|
||||
if (file_exists($pluginJsonPath)) {
|
||||
// 读取插件配置文件
|
||||
$installed[$filename] = json_decode($this->filesystem->get($pluginJsonPath), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
closedir($resource);
|
||||
|
||||
foreach ($installed as $dirname => $package) {
|
||||
|
||||
// 初始化插件信息
|
||||
$plugin = [];
|
||||
$plugin['name'] = (Arr::get($package, 'name'));
|
||||
$plugin['author'] = (Arr::get($package, 'author'));
|
||||
$plugin['describe'] = (Arr::get($package, 'describe'));
|
||||
$plugin['slug'] = (Arr::get($package, 'slug'));
|
||||
$plugin['version'] = (Arr::get($package, 'version'));
|
||||
$plugin['path'] = $this->getPluginsDir().DIRECTORY_SEPARATOR.$dirname;
|
||||
|
||||
if ($plugins->has($plugin['slug'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$plugins->put($plugin['slug'], $plugin);
|
||||
}
|
||||
|
||||
define('PLUGINS', $plugins->toArray());
|
||||
$this->plugins = $plugins;
|
||||
}
|
||||
|
||||
return $this->plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部插件的主文件
|
||||
*
|
||||
* @return Collection
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getPluginMainFiles(): Collection
|
||||
{
|
||||
$pluginMainFiles = new Collection;
|
||||
|
||||
try {
|
||||
foreach ($this->getPlugins() as $plugin) {
|
||||
if ($this->filesystem->exists($file = $plugin['path'].'/plugin.php')) {
|
||||
$pluginMainFiles->push($file);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// 输出错误信息
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
|
||||
return $pluginMainFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部插件的Composer装载文件
|
||||
*
|
||||
* @return Collection
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getComposerLoaders(): Collection
|
||||
{
|
||||
$composerLoaders = new Collection;
|
||||
|
||||
foreach ($this->getPlugins() as $plugin) {
|
||||
if ($this->filesystem->exists($file = $plugin['path'].'/vendor/autoload.php')) {
|
||||
$composerLoaders->push($file);
|
||||
}
|
||||
}
|
||||
|
||||
return $composerLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插件目录
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPluginsDir(): string
|
||||
{
|
||||
return config('plugins.directory') ?: base_path('plugins');
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 耗子Linux面板 - 帮助函数
|
||||
* @author 耗子
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取网络统计信息
|
||||
* @return array
|
||||
*/
|
||||
function getNetInfo(): array
|
||||
{
|
||||
$networkRaw = file_get_contents('/proc/net/dev');
|
||||
$networkArr = explode("\n", $networkRaw);
|
||||
foreach ($networkArr as $key => $val) {
|
||||
if ($key < 2) {
|
||||
continue;
|
||||
}
|
||||
$val = str_replace(':', ' ', trim($val));
|
||||
$val = preg_replace("/[ ]+/", " ", $val);
|
||||
$arr = explode(' ', $val);
|
||||
if (!empty($arr[0])) {
|
||||
$arr = array($arr[0], $arr[1], $arr[9]);
|
||||
$allRs[$arr[0].$key] = $arr;
|
||||
}
|
||||
}
|
||||
ksort($allRs);
|
||||
$tx = 0;
|
||||
$rx = 0;
|
||||
foreach ($allRs as $key => $val) {
|
||||
// 排除本地lo
|
||||
if (str_contains($key, 'lo')) {
|
||||
continue;
|
||||
}
|
||||
$tx += $val[2];
|
||||
$rx += $val[1];
|
||||
}
|
||||
$res['tx'] = $tx;
|
||||
$res['rx'] = $rx;
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化bytes
|
||||
* @param $size
|
||||
* @return string
|
||||
*/
|
||||
function formatBytes($size): string
|
||||
{
|
||||
$size = is_numeric($size) ? $size : 0;
|
||||
$units = array(' B', ' KB', ' MB', ' GB', ' TB');
|
||||
for ($i = 0; $size >= 1024 && $i < 4; $i++) {
|
||||
$size /= 1024;
|
||||
}
|
||||
return round($size, 2).$units[$i];
|
||||
}
|
||||
|
||||
/**
|
||||
* 裁剪字符串
|
||||
* @param $begin
|
||||
* @param $end
|
||||
* @param $str
|
||||
* @return string
|
||||
*/
|
||||
function cut($begin, $end, $str): string
|
||||
{
|
||||
$b = mb_strpos($str, $begin) + mb_strlen($begin);
|
||||
$e = mb_strpos($str, $end) - $b;
|
||||
return mb_substr($str, $b, $e);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader
|
||||
| for our application. We just need to utilize it! We'll require it
|
||||
| into the script here so that we do not have to worry about the
|
||||
| loading of any of our classes manually. It's great to relax.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
$status = $kernel->handle(
|
||||
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||
new Symfony\Component\Console\Output\ConsoleOutput
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shutdown The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once Artisan has finished running, we will fire off the shutdown events
|
||||
| so that any final work may be done by the application before we shut
|
||||
| down the process. This is the last thing to happen to the request.
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel->terminate($input, $status);
|
||||
|
||||
exit($status);
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The first thing we will do is create a new Laravel application instance
|
||||
| which serves as the "glue" for all the components of Laravel, and is
|
||||
| the IoC container for the system binding all of the various parts.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bind Important Interfaces
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we need to bind some important interfaces into the container so
|
||||
| we will be able to resolve them when needed. The kernels serve the
|
||||
| incoming requests to this application from both the web and CLI.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Http\Kernel::class,
|
||||
App\Http\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Return The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This script returns the application instance. The instance is given to
|
||||
| the calling script so we can separate the building of the instances
|
||||
| from the actual running of the application and sending responses.
|
||||
|
|
||||
*/
|
||||
|
||||
return $app;
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -0,0 +1,3 @@
|
||||
# cmd
|
||||
|
||||
cmd 目录存放应用的入口文件。
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "time/tzdata"
|
||||
|
||||
"github.com/TheTNB/panel/internal/bootstrap"
|
||||
)
|
||||
|
||||
func main() {
|
||||
bootstrap.BootCli()
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "time/tzdata"
|
||||
|
||||
"github.com/TheTNB/panel/internal/bootstrap"
|
||||
)
|
||||
|
||||
func main() {
|
||||
bootstrap.BootWeb()
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1.9",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^9.19",
|
||||
"laravel/sanctum": "^3.0",
|
||||
"laravel/tinker": "^2.7",
|
||||
"overtrue/laravel-lang": "^6.0",
|
||||
"skoerfgen/acmecert": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^6.1",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"spatie/laravel-ignition": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
Generated
-8027
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
# 警告:未经指导私自修改此配置文件可能导致严重后果
|
||||
# Warning: Modifying this configuration file without guidance may cause serious consequences
|
||||
app:
|
||||
debug: false
|
||||
key: a-long-string-with-32-characters
|
||||
locale: zh_CN
|
||||
timezone: Asia/Shanghai
|
||||
root: /www
|
||||
http:
|
||||
debug: false
|
||||
port: 8888
|
||||
entrance: /
|
||||
tls: true
|
||||
database:
|
||||
debug: false
|
||||
-215
@@ -1,215 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => '耗子Linux面板',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => 'local',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => '.',
|
||||
|
||||
'asset_url' => '.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'PRC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'zh_CN',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'zh_CN',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'zh_CN',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => 'ctrlniganmaaiyouniganmaaiyouctrl',
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => 'file',
|
||||
// 'store' => 'redis',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\PluginServiceProvider::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'log',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'file',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
'lock_connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||
| stores there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 0,
|
||||
|
||||
'supports_credentials' => false,
|
||||
|
||||
];
|
||||
@@ -1,101 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'sqlite',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => '',
|
||||
'database' => database_path('database.sqlite'),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => true,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => '127.0.0.1',
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => '6379',
|
||||
'database' => '0',
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'local',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been set up for each driver as an example of the required values.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
/**
|
||||
* TODO 这里需要做点骚操作,直接获取分区信息进行填充
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'www' => [
|
||||
'driver' => 'local',
|
||||
'root' => '/www',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => '/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'argon2id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 65536,
|
||||
'threads' => 1,
|
||||
'time' => 4,
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'stack',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => null,
|
||||
'trace' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array", "failover"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'name' => '耗子Linux面板',
|
||||
'version' => '20230209',
|
||||
'plugin_dir' => '/www/panel/plugins',
|
||||
];
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => 'database',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. If this value is null, personal access tokens do
|
||||
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
'scheme' => 'https',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,201 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'file',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => 120,
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => 'database',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => '.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Storage Paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Most templating systems load templates from disk. Here you may specify
|
||||
| an array of paths that should be checked for your views. Of course
|
||||
| the usual Laravel view path has already been registered for you.
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => [
|
||||
resource_path('views'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Compiled View Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines where all the compiled Blade templates will be
|
||||
| stored for your application. Typically, this is within the storage
|
||||
| directory. However, as usual, you are free to change this value.
|
||||
|
|
||||
*/
|
||||
|
||||
'compiled' => env(
|
||||
'VIEW_COMPILED_PATH',
|
||||
realpath(storage_path('framework/views'))
|
||||
),
|
||||
|
||||
];
|
||||
@@ -1 +0,0 @@
|
||||
*.sqlite*
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('username');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('websites', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->index()->comment('网站名称');
|
||||
$table->boolean('status')->comment('是否运行');
|
||||
$table->string('path')->comment('网站路径');
|
||||
$table->integer('php')->comment('PHP版本');
|
||||
$table->boolean('ssl')->comment('是否启用SSL');
|
||||
$table->dateTime('ssl_date')->comment('SSL到期时间')->nullable();
|
||||
$table->string('note')->comment('备注')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('websites');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->index()->comment('设置名称');
|
||||
$table->string('value')->comment('设置值')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('databases', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->index()->comment('数据库名称');
|
||||
$table->string('type')->comment('数据库类型');
|
||||
$table->string('username')->comment('数据库用户名');
|
||||
$table->string('password')->comment('数据库密码')->nullable();
|
||||
$table->string('note')->comment('备注')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('databases');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('plugins', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('slug')->unique()->comment('插件标识');
|
||||
$table->boolean('show')->comment('是否首页显示')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('plugins');
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user