Compare commits

...
261 Commits
Author SHA1 Message Date
Mr Chen 4769ce5be8 Merge pull request #431 from midoks/dev
0.15.2
2023-08-05 15:12:37 +08:00
midoks 8e16cbf7f9 0.15.2 2023-08-05 15:06:22 +08:00
midoks 4225d4c040 Update common.py 2023-08-05 14:43:14 +08:00
midoks b578f2fddc Update common.py 2023-08-05 14:42:43 +08:00
midoks 961c3423fd Update common.py 2023-08-05 14:29:52 +08:00
midoks 8040c8c67a Update common.py 2023-08-05 14:21:25 +08:00
midoks 5aca7d7c26 Update common.py 2023-08-05 14:17:16 +08:00
midoks d9f99e6b7c Update common.py 2023-08-05 14:17:01 +08:00
midoks 3addb46708 Update common.py 2023-08-05 13:46:19 +08:00
midoks e6b493237d 优化初始化安装SSH端口识别 2023-08-05 13:36:13 +08:00
midoks 7f42054a14 Update ubuntu.sh 2023-08-05 12:29:39 +08:00
midoks 501af3da15 Update plugins_api.py 2023-08-05 12:01:46 +08:00
midoks 68727cbe91 Update site_api.py 2023-08-05 11:28:33 +08:00
midoks c5207961f3 Update index.py 2023-08-05 01:52:49 +08:00
midoks a04e05c7e8 Update index.py 2023-08-05 01:19:42 +08:00
midoks 5b8cca24aa Update index.py 2023-08-05 00:46:41 +08:00
midoks cafe58f3fc Update index.py 2023-08-05 00:45:04 +08:00
midoks d1e2781eb9 Update index.py 2023-08-05 00:44:48 +08:00
midoks 67c899fc84 Update index.py 2023-08-05 00:43:06 +08:00
midoks 7432548ff9 Update index.py 2023-08-05 00:24:35 +08:00
midoks 0c2c136097 Update index.py 2023-08-04 23:58:21 +08:00
midoks 2a7e21951b Update my8.0.cnf 2023-08-04 22:49:18 +08:00
midoks 066185e404 网站设置反向代理升级功能 2023-08-04 20:27:20 +08:00
midoks bd431f1647 docker阶段性完成 2023-08-03 18:37:14 +08:00
midoks 0a6e88d81d update 2023-08-03 17:00:12 +08:00
midoks 02c9988ef7 Update docker.js 2023-08-03 00:24:13 +08:00
midoks 5ee7df4a46 Update nginx.conf 2023-08-03 00:14:16 +08:00
midoks 5f382c0034 update 2023-08-03 00:06:01 +08:00
midoks 63d17c4d77 Update docker.js 2023-08-02 23:24:10 +08:00
midoks 38722c1dc2 Update index.py 2023-08-02 17:51:29 +08:00
midoks ea982b7261 Update README.md 2023-08-02 17:50:22 +08:00
midoks 73d9edced8 使用mariadb二进制导入备份文件 2023-08-02 17:36:27 +08:00
midoks af03c004a3 Update rsyncd.js 2023-08-02 15:35:30 +08:00
midoks ddd9e70ac2 Update rsyncd.js 2023-08-02 15:29:32 +08:00
midoks 8976a7a147 Update rsyncd.js 2023-08-02 15:26:55 +08:00
midoks 677ff8ec0c Update README.md 2023-08-02 15:10:42 +08:00
midoks 47d240e2b8 rsyncd添加优化 2023-08-02 15:10:23 +08:00
midoks 1f7bd76875 Update crontab_api.py 2023-08-02 14:27:04 +08:00
midoks f04c70f022 计划任务自动脚本运行时间 2023-08-02 14:04:00 +08:00
midoks 5044cc5db9 Update README.md 2023-08-02 00:06:51 +08:00
midoks 4329b90ac4 Update info.json 2023-08-01 23:58:10 +08:00
midoks f7873b6dcd Update init_cmd.py 2023-07-25 00:03:20 +08:00
midoks a80d666786 update 2023-07-24 23:52:38 +08:00
Mr Chen 0598704dce Merge pull request #428 from midoks/dev
修复centos9源安装问题
2023-07-22 12:54:17 +08:00
midoks 8f19a05755 Update rhel.sh 2023-07-22 12:53:07 +08:00
midoks f320d7cc69 Update rhel.sh 2023-07-22 12:26:56 +08:00
midoks 1e97929a24 Update push_notice_msg.py 2023-07-21 12:10:55 +08:00
Mr Chen c66bbac97e Merge pull request #427 from midoks/dev
python3.7 urllib3在亚马逊降级
2023-07-20 16:14:22 +08:00
midoks 1f7a0d2795 Create r3.7.txt 2023-07-20 16:04:18 +08:00
midoks f05ce79e63 Update rhel.sh 2023-07-20 15:55:11 +08:00
midoks 9f3d06191a PHP提示优化 2023-07-19 18:35:27 +08:00
Mr Chen 2c6614a5ff Merge pull request #426 from midoks/dev
赞助换域名
2023-07-18 15:23:49 +08:00
midoks 905bad29cf Update README.md 2023-07-18 15:22:19 +08:00
midoks 9ba572a8ce AD修改 2023-07-16 17:23:45 +08:00
Mr Chen 85fc333d2c Merge pull request #424 from midoks/dev
0.15.1
2023-07-15 23:04:39 +08:00
midoks 5bc27a4725 Update config_api.py 2023-07-15 22:53:38 +08:00
midoks e5acf206f5 Update cli.sh 2023-07-15 20:43:13 +08:00
midoks ae7afc2eb5 Update rhel.sh 2023-07-15 20:34:46 +08:00
midoks 5c8527a5de 监控页面-自定义时间优化。 2023-07-15 19:33:17 +08:00
midoks 274592229e Update rhel.sh 2023-07-15 15:51:03 +08:00
midoks 60ddb13f8e Update rhel.sh 2023-07-15 15:50:35 +08:00
midoks f62af00fb7 Update rhel.sh 2023-07-15 15:49:28 +08:00
midoks 9c6faefffd Update rhel.sh 2023-07-15 15:38:14 +08:00
midoks c9e27c2add 优化
* [插件]docker - 添加IP地址池。
* PHP下载中国优化。
2023-07-15 15:00:00 +08:00
midoks 97b1e8b9b3 Update rhel.sh 2023-07-15 12:34:47 +08:00
midoks 18cdcd1436 修复子目录绑定-伪静态问题。 2023-07-13 10:36:16 +08:00
midoks 7d783c64b6 OP防火墙优化
站点配置-状态关闭后,不再防御。
2023-07-13 00:40:46 +08:00
midoks 0b65d69750 Update __init__.py 2023-07-12 22:18:55 +08:00
midoks 693dbb8cf1 Update __init__.py 2023-07-12 22:17:58 +08:00
midoks 117a99e729 增加标识 2023-07-12 09:46:58 +08:00
midoks 45d4b8a5de update 2023-07-11 16:25:34 +08:00
midoks a5791051b1 Update debian.sh 2023-07-11 16:11:20 +08:00
midoks dc3f8f8e0b 自动同步gitee 2023-07-11 12:21:48 +08:00
midoks bf1d00c012 Update config_api.py 2023-07-10 22:41:13 +08:00
midoks 51cf851cea Update site.js 2023-07-10 22:38:37 +08:00
midoks 1e09408eb9 Update index.py 2023-07-10 22:13:46 +08:00
midoks 7659865caf Update lib.sh 2023-07-05 22:19:44 +08:00
Mr Chen ad1851d068 Merge pull request #423 from midoks/dev
requests兼容低版本
2023-07-05 18:05:33 +08:00
midoks e174652afc Update requirements.txt 2023-07-05 18:02:40 +08:00
midoks a95e7aacd7 Update r3.6.txt 2023-07-05 18:00:36 +08:00
Mr Chen 6aa638ef9a Merge pull request #422 from midoks/dev
Update requirements.txt
2023-07-05 13:03:14 +08:00
midoks 6f3d50bae5 Update requirements.txt 2023-07-05 13:01:08 +08:00
Mr Chen 301a5a95b8 Merge pull request #421 from midoks/dev
AD
2023-07-05 12:51:37 +08:00
midoks d35b9dccc7 AD信息 2023-07-05 12:49:47 +08:00
midoks 82680605ac mvirtua ad 2023-07-05 12:47:05 +08:00
midoks 5b148b3d1a Update requirements.txt 2023-07-05 10:20:04 +08:00
Mr Chen 714acd20e5 Merge pull request #420 from midoks/dev
0.15.0
2023-07-04 20:55:21 +08:00
midoks bf58cd8acc Update config_api.py 2023-07-04 20:52:57 +08:00
midoks 059053d27c mysql安装成功后,删除原文件 2023-07-03 22:22:11 +08:00
midoks 185e73c26a Update index.py 2023-07-03 22:12:55 +08:00
midoks 569511d321 update 2023-07-03 22:08:00 +08:00
midoks f88bf5059f Update README.md 2023-07-03 17:52:56 +08:00
midoks 05b63b8d2b Update index.py 2023-07-03 17:45:12 +08:00
midoks 3a197b273d Update docker.js 2023-07-03 17:37:14 +08:00
midoks f4fdbab41c Update index.py 2023-07-03 17:35:34 +08:00
midoks f6b2940657 docker插件容器创建OK 2023-07-03 17:34:58 +08:00
midoks 78b9ac5df0 up 2023-07-03 11:53:54 +08:00
midoks 3ea4272307 Update docker.js 2023-07-02 16:29:10 +08:00
midoks efc7cee9ad Update docker.js 2023-07-02 15:36:38 +08:00
midoks 5c4805453d Update docker.js 2023-07-02 15:27:25 +08:00
midoks f6da241c85 update 2023-07-02 14:38:56 +08:00
midoks d5b6eb2325 update 2023-07-01 22:06:54 +08:00
midoks 6ed2cddf71 Update docker.js 2023-07-01 21:35:46 +08:00
midoks 9c31d76442 docker update 2023-07-01 21:34:04 +08:00
midoks 7aecbaf7df Update docker.js 2023-07-01 15:22:41 +08:00
midoks ee81a86d24 update 2023-07-01 15:17:43 +08:00
midoks 0a60d66732 update 2023-07-01 14:46:22 +08:00
midoks c3e3cff472 Update docker.js 2023-07-01 12:37:15 +08:00
midoks 194d46eb6a Update docker.js 2023-07-01 12:37:02 +08:00
midoks d66bc94edc Update docker.js 2023-07-01 12:34:09 +08:00
midoks fb4ffcd343 Update index.py 2023-07-01 12:30:58 +08:00
midoks 10c235e317 Update r3.6.txt 2023-07-01 12:25:32 +08:00
midoks 9c156928d8 up 2023-07-01 12:24:04 +08:00
midoks 771905d7f6 Update requirements.txt 2023-07-01 12:23:01 +08:00
midoks cd21b3f3e7 Update r3.6.txt 2023-07-01 12:22:18 +08:00
midoks 982026db24 update 2023-07-01 12:21:07 +08:00
midoks f9b91d9989 Update docker.js 2023-07-01 12:17:30 +08:00
midoks f7b1159bd7 update 2023-07-01 12:15:51 +08:00
midoks 6aa49ddbcf Update rhel.sh 2023-07-01 11:48:06 +08:00
midoks 866eddac1d Update lib.sh 2023-07-01 10:19:42 +08:00
midoks af0cce4216 Update install.sh 2023-07-01 10:16:39 +08:00
midoks 3951322d86 Update install_dev.sh 2023-07-01 10:16:23 +08:00
midoks dfdd16b444 Update index.py 2023-07-01 10:11:15 +08:00
midoks aa8fec2b7e update 2023-07-01 09:52:53 +08:00
midoks 2a8958ab84 Update index.py 2023-07-01 00:32:36 +08:00
midoks f5125670ee Update index.py 2023-07-01 00:19:24 +08:00
midoks 2a8d4fb7a9 Update requirements.txt 2023-07-01 00:14:04 +08:00
midoks 59f7fe2290 Update requirements.txt 2023-07-01 00:07:30 +08:00
midoks 928db6e7e7 Update requirements.txt 2023-07-01 00:02:13 +08:00
midoks f3927bd6cf Update requirements.txt 2023-07-01 00:01:32 +08:00
midoks bb92727b56 Update requirements.txt 2023-07-01 00:00:14 +08:00
midoks 21b80b1fce Update index.py 2023-06-30 23:54:05 +08:00
midoks 637da92834 up 2023-06-30 23:43:51 +08:00
midoks f5859626a9 update 2023-06-30 21:57:42 +08:00
midoks 003449eb0a update 2023-06-30 12:30:28 +08:00
midoks d27f926191 update 2023-06-30 12:16:25 +08:00
midoks 7483247d4d up 2023-06-30 10:17:02 +08:00
midoks 1ad841d3af Update docker.js 2023-06-30 00:09:15 +08:00
midoks 27376d879c up 2023-06-30 00:09:09 +08:00
midoks 8b824447c1 Update php.service.tpl 2023-06-29 18:29:39 +08:00
midoks a1d26dcd45 Update intl.sh 2023-06-29 16:25:12 +08:00
midoks 5e68c7bf0a Update install.sh 2023-06-29 13:00:08 +08:00
midoks 481ae16713 Update index.py 2023-06-29 12:59:05 +08:00
midoks 2d2bd39f9e Update intl.sh 2023-06-29 12:02:48 +08:00
midoks 7246a878a5 Update intl.sh 2023-06-29 12:00:37 +08:00
midoks 542ee3cdb0 Update intl.sh 2023-06-29 11:59:59 +08:00
midoks 69503b223b update 2023-06-29 11:43:56 +08:00
midoks 78d8fa7ebf Update lib.sh 2023-06-29 10:54:26 +08:00
midoks 21e9d8f2d8 Update update_dev.sh 2023-06-29 10:49:10 +08:00
midoks 3c6adfbd44 Update install.sh 2023-06-29 10:41:10 +08:00
midoks c0e70abe6d Update install_dev.sh 2023-06-29 10:40:31 +08:00
midoks f174e71228 Update app.py 2023-06-29 10:25:14 +08:00
midoks 7a9a811ea6 Update app.py 2023-06-29 10:21:39 +08:00
midoks c7e3d9d9a3 Update app.py 2023-06-29 10:20:39 +08:00
midoks 161f7a1bc0 Update app.py 2023-06-29 10:18:52 +08:00
midoks 175cce0131 Update lib.sh 2023-06-29 10:11:52 +08:00
midoks 3735897ed2 Update lib.sh 2023-06-29 09:59:06 +08:00
midoks 30bfa5a630 Update lib.sh 2023-06-29 09:56:24 +08:00
midoks 594fdb4712 Update lib.sh 2023-06-29 09:55:14 +08:00
midoks 31a441ea02 update 2023-06-29 09:52:30 +08:00
midoks 06f7087fad Update requirements.txt 2023-06-29 09:30:06 +08:00
midoks e7b8f5afdc Update index.py 2023-06-29 09:25:55 +08:00
midoks 6b57addfa7 Update index.py 2023-06-28 19:11:44 +08:00
midoks aea435fbaf Update index.py 2023-06-28 18:53:45 +08:00
midoks 9cd6656946 u 2023-06-28 16:04:17 +08:00
midoks 4f7df4b3c3 Update index.py 2023-06-28 14:58:45 +08:00
midoks 70d12b7b8d docker 2023-06-28 14:53:59 +08:00
midoks fe576c820a Update requirements.txt 2023-06-28 04:09:09 +08:00
midoks b48a53e0d7 Create nezha.conf 2023-06-28 04:04:44 +08:00
midoks 4701839c33 up 2023-06-28 03:40:23 +08:00
midoks 916bc67c4d Update cert_api.py 2023-06-28 03:21:11 +08:00
midoks d7bba830cc Update requirements.txt 2023-06-28 02:33:11 +08:00
midoks 7a28f8f57a Update index.py 2023-06-28 02:30:28 +08:00
midoks 41ee25aa7b update 2023-06-28 02:21:59 +08:00
midoks c8aa91cfa3 up 2023-06-28 02:09:28 +08:00
midoks 98f27498b0 Update index.py 2023-06-28 01:57:06 +08:00
midoks 5444fe6455 Update index.py 2023-06-28 01:40:41 +08:00
midoks 9627c6e47b Update index.py 2023-06-28 01:32:14 +08:00
midoks 13597d6282 Update index.py 2023-06-28 01:21:15 +08:00
midoks d09494e3aa Update index.py 2023-06-28 01:14:15 +08:00
midoks d35439d286 Update index.py 2023-06-28 01:14:03 +08:00
midoks ced48bab47 nezha 测试OK 2023-06-28 01:02:58 +08:00
midoks fe2df6cc8d up 2023-06-28 00:08:38 +08:00
midoks 8bdfe15101 nezha 60% 2023-06-28 00:04:07 +08:00
midoks 42e9983b88 Update config.json 2023-06-27 15:56:43 +08:00
midoks 9b7c0b6f99 up 2023-06-27 15:11:38 +08:00
midoks e421292c9e up 2023-06-27 14:13:04 +08:00
midoks 7b4d31779a Update install.sh 2023-06-27 01:31:52 +08:00
midoks f3b09056f3 init nezha plugin 2023-06-26 23:06:06 +08:00
midoks a92ccea6c5 lrzsz 2023-06-26 11:57:07 +08:00
midoks 9da77a0a9b up 2023-06-24 22:37:02 +08:00
midoks c233ecaaa7 up 2023-06-22 16:06:04 +08:00
midoks 5828b8b8cb up 2023-06-22 16:00:09 +08:00
midoks a4a1a2c83c up 2023-06-20 16:39:36 +08:00
midoks 0e20bc182c up 2023-06-19 20:28:44 +08:00
midoks 99c0b0a81a Update site_api.py 2023-06-17 23:20:24 +08:00
midoks 3fa199fec4 acme部署问题 2023-06-17 23:18:15 +08:00
midoks 194c36c6d8 tg ad 2023-06-15 01:43:21 +08:00
midoks 2fb542f6b4 Update all_test.sh 2023-06-14 01:25:55 +08:00
midoks 60af43ed31 Update intl.sh 2023-06-14 01:24:15 +08:00
midoks 9f02cf9744 Update install.sh 2023-06-14 01:21:47 +08:00
midoks 846bd270df Update yaf.sh 2023-06-14 01:14:47 +08:00
midoks d910d4f462 up 2023-06-14 00:31:20 +08:00
midoks 13f5b1bf02 up 2023-06-13 18:34:57 +08:00
midoks 1fc3fd6247 Update lib.sh 2023-06-13 18:03:53 +08:00
midoks 36e3feb886 Update requirements.txt 2023-06-13 17:46:00 +08:00
midoks 0ca34afacd Update lib.sh 2023-06-13 17:43:39 +08:00
midoks ffb3288f3d Update requirements.txt 2023-06-13 17:40:55 +08:00
midoks e2f68a73ed Update requirements.txt 2023-06-13 17:34:23 +08:00
midoks 92fa8da2f6 Update lib.sh 2023-06-13 17:19:23 +08:00
midoks 7c96ddd63e Update lib.sh 2023-06-13 17:14:50 +08:00
midoks c4e7872179 Update lib.sh 2023-06-13 17:14:31 +08:00
midoks d399cb2bb4 Update install.sh 2023-06-13 16:38:04 +08:00
midoks 985cbc7eca Update install.sh 2023-06-13 16:36:48 +08:00
midoks 27ed21a17d update 2023-06-10 15:09:31 +08:00
midoks 972165ba1a Update lib.sh 2023-05-30 17:53:16 +08:00
midoks e76eb4d0e8 Update client_check_member.py 2023-05-29 18:40:12 +08:00
midoks fd05c40dbb up 2023-05-29 18:34:37 +08:00
midoks a1a7fa5c82 网站备注优化 2023-05-28 19:59:31 +08:00
midoks 531de1407f Update push_notice_msg.py 2023-05-28 19:00:42 +08:00
midoks ca455f13e8 ad 2023-05-28 14:50:53 +08:00
midoks ab5342b01f Update docker.js 2023-05-27 00:18:44 +08:00
midoks a5a57c5718 update 2023-05-27 00:18:39 +08:00
midoks 27999b21e6 Update config.json 2023-05-24 23:04:59 +08:00
midoks d2c6caeef2 Update client_temp.py 2023-05-23 20:46:32 +08:00
midoks de30d8a41f Create client_temp.py 2023-05-23 20:42:08 +08:00
midoks d3abc8e7b2 up 2023-05-18 17:10:50 +08:00
midoks b7aad65eb5 Update site_api.py 2023-05-17 13:36:35 +08:00
midoks 240b1dec27 修正网站搜索功能 2023-05-16 20:34:12 +08:00
midoks 4756e0f68b Update push_notice_msg.py 2023-05-15 19:30:38 +08:00
midoks 59f62b948a Update push_notice_msg.py 2023-05-15 19:30:00 +08:00
midoks 0ab0741031 up 2023-05-15 19:23:32 +08:00
midoks 2fd2f6e844 AD 2023-05-15 19:20:58 +08:00
midoks e534c6177a update 2023-05-15 19:14:43 +08:00
midoks 897c6322fc Update install.sh 2023-05-14 23:57:41 +08:00
midoks 201e93f946 Update requirements.txt 2023-05-14 19:09:02 +08:00
Mr Chen a78fd957ec Merge pull request #411 from midoks/dev
更新pip库2
2023-05-14 19:05:30 +08:00
midoks 3ce037b0a1 Update requirements.txt 2023-05-14 19:03:39 +08:00
midoks f3176340f8 Update requirements.txt 2023-05-14 19:02:58 +08:00
midoks 7bfe096e8d Update requirements.txt 2023-05-14 19:00:45 +08:00
Mr Chen 066428fca8 Merge pull request #410 from midoks/dev
更新pip版本
2023-05-14 18:46:51 +08:00
midoks a1313846c8 Update requirements.txt 2023-05-14 18:43:47 +08:00
midoks 0433123abd Update requirements.txt 2023-05-14 18:36:50 +08:00
midoks 72e99844dd Update requirements.txt 2023-05-14 18:31:19 +08:00
Mr Chen 3a7882e7fa Merge pull request #409 from midoks/dev
0.14.5
2023-05-14 13:12:27 +08:00
midoks bec2a9a12c 0.14.5
* 软件管理-搜索功能。
* 文件-右键功能优化。
2023-05-14 13:10:17 +08:00
midoks 8f02363782 Update files.html 2023-05-12 11:22:38 +08:00
midoks 939c847f3e Update plugins_api.py 2023-05-10 18:23:06 +08:00
midoks a623039db7 完成搜索功能 2023-05-10 18:20:48 +08:00
midoks b7f49a1839 Update soft.html 2023-05-10 17:59:17 +08:00
midoks f1f60870f6 up 2023-05-09 12:46:09 +08:00
midoks 3b04739fd4 up 2023-05-09 12:45:25 +08:00
midoks fdf1e0b0be up 2023-05-09 12:39:44 +08:00
midoks d3385f526f Update client_check_member.py 2023-05-09 11:37:39 +08:00
midoks 20f9095b93 up 2023-05-09 09:17:54 +08:00
midoks 757cf483a2 Update client_ad.py 2023-05-08 12:07:36 +08:00
midoks 1712cfd024 Update client_ad.py 2023-05-08 12:03:16 +08:00
midoks 2b524cbe75 Update client_ad.py 2023-05-08 11:57:01 +08:00
midoks 607d384000 Update client_ad.py 2023-05-08 11:29:09 +08:00
midoks 14cdc7b82e Update client_ad.py 2023-05-08 11:15:27 +08:00
midoks c3219bcba2 Update client_check_member.py 2023-05-07 23:15:06 +08:00
119 changed files with 4784 additions and 922 deletions
+16
View File
@@ -0,0 +1,16 @@
name: sync2gitee
on: [push]
jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- name: Mirror the Github organization repos to Gitee.
uses: Yikun/hub-mirror-action@master
with:
src: 'github/midoks'
dst: 'gitee/midoks'
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "mdserver-web"
force_update: true
+10 -5
View File
@@ -79,7 +79,7 @@ PHP[72-82]支持phpMyAdmin[5.2.0]
# 特别赞助
- [找资源 - 阿里云盘资源搜索引擎](https://zhaoziyuan.la/)
- [找资源 - 阿里云盘资源搜索引擎](https://zhaoziyuan.pw/)
# AD - VPS推荐 - 🙏
@@ -88,6 +88,7 @@ PHP[72-82]支持phpMyAdmin[5.2.0]
| 服务商 | LOGO | 推广地址 | 优惠码 |
| ------------- |----------|-----------|-------|
| digitalvirt |[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/aff.php?aff=154) | https://digitalvirt.com/aff.php?aff=154 | mdserver-web |
| mvirtua |[![mvirtua](https://mvirtua.com/upload/logo-black.png)](https://mvirtua.com/aff/FUSKXVDH) | https://mvirtua.com/aff/FUSKXVDH | mdserver-web (全场8折)|
# Docker
@@ -99,11 +100,15 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```
### 版本更新 0.14.4
### 版本更新 0.15.2
* 安装优化,redat系列优化。
* PHP74-82在redat的安装修复(oniguruma)。
* 面板端口修改优化。
* OpenResty升级到1.21.4.2
* 计划任务自动脚本运行时间
* rsyncd添加优化
* 使用mariadb二进制导入备份文件
* docker插件-镜像导入导出功能
* 网站设置反向代理升级功能
* 优化初始化安装SSH端口识别
### JSDelivr安装地址
+1
View File
@@ -28,6 +28,7 @@ from route import app, socketio
from gevent.pywsgi import WSGIServer
from geventwebsocket.handler import WebSocketHandler
from gevent import monkey
monkey.patch_all()
+2 -1
View File
@@ -930,7 +930,8 @@ fi
index).encode()
)
X509Req.set_pubkey(pk)
X509Req.set_version(2)
# X509Req.set_version(2)
X509Req.set_version(0)
X509Req.sign(pk, self.__digest)
return OpenSSL.crypto.dump_certificate_request(OpenSSL.crypto.FILETYPE_ASN1, X509Req)
+2 -1
View File
@@ -840,7 +840,8 @@ class cert_request:
index).encode()
)
X509Req.set_pubkey(pk)
X509Req.set_version(2)
# X509Req.set_version(2)
X509Req.set_version(0)
X509Req.sign(pk, self.__digest)
return OpenSSL.crypto.dump_certificate_request(OpenSSL.crypto.FILETYPE_ASN1, X509Req)
+12
View File
@@ -33,6 +33,7 @@ from flask import redirect
def init():
initDB()
initDBSshPort()
initUserInfo()
initInitD()
initInitTask()
@@ -62,6 +63,17 @@ def initDB():
print(str(ex))
def initDBSshPort():
# SSH端口必须放开
import firewall_api
cmd_data = mw.execShell(
"cat /etc/ssh/sshd_config | grep '^Port \d*' | tail -1")
ssh_port = cmd_data[0].replace("Port ", '').strip()
if ssh_port == '':
ssh_port = '22'
firewall_api.firewall_api().addAcceptPortArgs(ssh_port, 'SSH远程管理服务', 'port')
def doContentReplace(src, dst):
content = mw.readFile(src)
content = content.replace("{$SERVER_PATH}", mw.getRunDir())
+1 -1
View File
@@ -27,7 +27,7 @@ from flask import request
class config_api:
__version = '0.14.4'
__version = '0.15.2'
__api_addr = 'data/api.json'
def __init__(self):
+21 -2
View File
@@ -508,6 +508,22 @@ class crontab_api:
else:
head = "#!/bin/bash\nPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin\nexport PATH\n"
start_head = '''
SCRIPT_RUN_TIME="0s"
MW_ToSeconds()
{
SEC=$1
if [ $SEC -lt 60 ]; then
SCRIPT_RUN_TIME="${SEC}s"
elif [ $SEC -ge 60 ] && [ $SEC -lt 3600 ];then
SCRIPT_RUN_TIME="$(( SEC / 60 ))m$(( SEC % 60 ))s"
elif [ $SEC -ge 3600 ]; then
SCRIPT_RUN_TIME="$(( SEC / 3600 ))h$(( (SEC % 3600) / 60 ))m$(( (SEC % 3600) % 60 ))s"
fi
}
START_MW_SHELL_TIME=`date +%s`
'''
source_bin_activate = '''
export LANG=en_US.UTF-8
MW_PATH=%s/bin/activate
@@ -515,7 +531,7 @@ if [ -f $MW_PATH ];then
source $MW_PATH
fi''' % (mw.getRunDir(),)
head = head + source_bin_activate + "\n"
head = head + start_head + source_bin_activate + "\n"
log = '.log'
script_dir = mw.getRunDir() + "/scripts"
@@ -557,7 +573,10 @@ fi''' % (mw.getRunDir(),)
shell += '''
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
echo "★[$endDate] Successful"
END_MW_SHELL_TIME=`date +"%s"`
((SHELL_COS_TIME=($END_MW_SHELL_TIME-$START_MW_SHELL_TIME)))
MW_ToSeconds $SHELL_COS_TIME
echo "★[$endDate] Successful | Script Run [$SCRIPT_RUN_TIME] "
echo "----------------------------------------------------------------------------"
'''
cronPath = mw.getServerDir() + '/cron'
+1 -1
View File
@@ -65,7 +65,7 @@ class Sql():
self.__DB_TABLE = table
return self
def where(self, where, param):
def where(self, where, param=()):
# WHERE条件
if where:
self.__OPT_WHERE = " WHERE " + where
+7 -1
View File
@@ -1215,6 +1215,12 @@ def formatDate(format="%Y-%m-%d %H:%M:%S", times=None):
return time.strftime(format, time_local)
def strfToTime(sdate):
# 转换时间
import time
return time.strftime('%Y-%m-%d', time.strptime(sdate, '%b %d %H:%M:%S %Y %Z'))
def checkIp(ip):
# 检查是否为IPv4地址
import re
@@ -1405,7 +1411,7 @@ def makeConf():
file = getRunDir() + '/data/json/config.json'
if not os.path.exists(file):
c = {}
c['title'] = '金蝉面板'
c['title'] = '金灵面板'
c['home'] = 'http://github/midoks/mdserver-web'
c['recycle_bin'] = True
c['template'] = 'default'
+22 -8
View File
@@ -71,8 +71,9 @@ class plugins_api:
if not mw.isNumber(sType):
sType = 0
# print sPage
data = self.getPluginList(sType, int(sPage))
# print(sPage, sType)
search = request.args.get('search', '').lower()
data = self.getPluginList(sType, search, int(sPage))
return mw.getJson(data)
def menuGetAbsPath(self, tag, path):
@@ -138,7 +139,7 @@ class plugins_api:
def initApi(self):
plugin_names = {
'openresty': '1.21.4.1',
'openresty': '1.21.4.2',
'php': '56',
'swap': '1.1',
'mysql': '5.7',
@@ -781,7 +782,18 @@ class plugins_api:
print(e)
return plugins_info
def getAllListPage(self, sType='0', page=1, pageSize=10):
def searchKey(self, info, kw):
try:
if info['title'].lower().find(kw) > -1:
return True
if info['ps'].lower().find(kw) > -1:
return True
if info['name'].lower().find(kw) > -1:
return True
except Exception as e:
return False
def getAllListPage(self, sType='0', kw='', page=1, pageSize=10):
plugins_info = []
for dirinfo in os.listdir(self.__plugin_dir):
if dirinfo[0:1] == '.':
@@ -792,11 +804,13 @@ class plugins_api:
if os.path.exists(json_file):
try:
data = json.loads(mw.readFile(json_file))
# 判断是否搜索
if kw != '' and not self.searchKey(data, kw):
continue
tmp_data = self.makeList(data, sType)
for index in range(len(tmp_data)):
plugins_info.append(tmp_data[index])
except Exception as e:
print(json_file)
print(mw.getTracebackInfo())
start = (page - 1) * pageSize
@@ -927,14 +941,14 @@ class plugins_api:
return plugins_info
def getPluginList(self, sType, sPage=1, sPageSize=10):
# print sType, sPage, sPageSize
def getPluginList(self, sType, kw='', sPage=1, sPageSize=10):
# print(sType, kw, sPage, sPageSize)
ret = {}
ret['type'] = json.loads(mw.readFile(self.__type))
# plugins_info = self.getAllListThread(sType)
# plugins_info = self.getAllListProcess(sType)
data = self.getAllListPage(sType, sPage, sPageSize)
data = self.getAllListPage(sType, kw, sPage, sPageSize)
ret['data'] = data[0]
args = {}
+125 -56
View File
@@ -101,19 +101,31 @@ class site_api:
limit = request.form.get('limit', '10')
p = request.form.get('p', '1')
type_id = request.form.get('type_id', '0').strip()
search = request.form.get('search', '').strip()
start = (int(p) - 1) * (int(limit))
siteM = mw.M('sites').field('id,name,path,status,ps,addtime,edate')
if type_id != '' and int(type_id) >= 0:
siteM.where('type_id=?', (type_id,))
sql_where = ''
if search != '':
sql_where = " name like '%" + search + "%' or ps like '%" + search + "%' "
if type_id != '' and int(type_id) >= 0 and search != '':
sql_where = sql_where + " and type_id=" + type_id + ""
elif type_id != '' and int(type_id) >= 0:
sql_where = " type_id=" + type_id
if sql_where != '':
siteM.where(sql_where)
_list = siteM.limit((str(start)) + ',' +
limit).order('id desc').select()
for i in range(len(_list)):
_list[i]['backup_count'] = mw.M('backup').where(
"pid=? AND type=?", (_list[i]['id'], 0)).count()
if _list != None:
for i in range(len(_list)):
_list[i]['backup_count'] = mw.M('backup').where(
"pid=? AND type=?", (_list[i]['id'], 0)).count()
_ret = {}
_ret['data'] = _list
@@ -775,6 +787,9 @@ class site_api:
mw.execShell('echo "lets" > "' + path + '/README"')
elif ssl_type == 'acme':
ssl_acme_dir = mw.getAcmeDir() + '/' + site_name
if not os.path.exists(ssl_acme_dir):
ssl_acme_dir = mw.getAcmeDir() + '/' + site_name + '_ecc'
acme_csrpath = ssl_acme_dir + '/fullchain.cer'
acme_keypath = ssl_acme_dir + '/' + site_name + '.key'
if mw.md5(mw.readFile(acme_csrpath)) == mw.md5(mw.readFile(csr_path)):
@@ -1420,6 +1435,8 @@ class site_api:
data['data'] = mw.readFile(filename)
data['rlist'] = []
for ds in os.listdir(self.rewritePath):
if ds[0:1] == '.':
continue
if ds == 'list.txt':
continue
data['rlist'].append(ds[0:len(ds) - 5])
@@ -1853,19 +1870,16 @@ class site_api:
if _id == '' or _siteName == '':
return mw.returnJson(False, "必填项不能为空!")
_old_config = mw.readFile(
"{}/{}/{}.conf".format(self.proxyPath, _siteName, _id))
if _old_config == False:
return mw.returnJson(False, "非法操作")
mw.writeFile("{}/{}/{}.conf".format(self.proxyPath,
_siteName, _id), _config)
proxy_file = "{}/{}/{}.conf".format(self.proxyPath, _siteName, _id)
mw.backFile(proxy_file)
mw.writeFile(proxy_file, _config)
rule_test = mw.checkWebConfig()
if rule_test != True:
mw.writeFile("{}/{}/{}.conf".format(self.proxyPath,
_siteName, _id), _old_config)
mw.restoreFile(proxy_file)
mw.removeBackFile(proxy_file)
return mw.returnJson(False, "OpenResty 配置测试不通过, 请重试: {}".format(rule_test))
mw.removeBackFile(proxy_file)
self.operateRedirectConf(_siteName, 'start')
mw.restartWeb()
return mw.returnJson(True, "ok")
@@ -1906,21 +1920,20 @@ class site_api:
_from = request.form.get('from', '')
_to = request.form.get('to', '')
_host = request.form.get('host', '')
_name = request.form.get('name', '')
_open_proxy = request.form.get('open_proxy', '')
_open_cache = request.form.get('open_cache', '')
_cache_time = request.form.get('cache_time', '')
_id = request.form.get('id', '')
if _siteName == "" or _from == "" or _to == "" or _host == "":
# print(_name, _siteName, _from, _to, _host)
if _name == "" or _siteName == "" or _from == "" or _to == "" or _host == "":
return mw.returnJson(False, "必填项不能为空")
data_path = self.getProxyDataPath(_siteName)
data_content = mw.readFile(
data_path) if os.path.exists(data_path) else ""
data = json.loads(data_content) if data_content != "" else []
rep = "http(s)?\:\/\/([a-zA-Z0-9][-a-zA-Z0-9]{0,62}\.)+([a-zA-Z0-9][a-zA-Z0-9]{0,62})+.?"
if not re.match(rep, _to):
return mw.returnJson(False, "错误的目标地址!")
# _to = _to.strip("/")
# get host from url
try:
if _host == "$host":
@@ -1929,7 +1942,11 @@ class site_api:
except:
return mw.returnJson(False, "错误的目标地址")
# location ~* ^{from}(.*)$ {
proxy_site_path = self.getProxyDataPath(_siteName)
data_content = mw.readFile(
proxy_site_path) if os.path.exists(proxy_site_path) else ""
data = json.loads(data_content) if data_content != "" else []
tpl = "#PROXY-START\n\
location ^~ {from} {\n\
proxy_pass {to};\n\
@@ -1937,12 +1954,29 @@ location ^~ {from} {\n\
proxy_set_header X-Real-IP $remote_addr;\n\
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\
proxy_set_header REMOTE-HOST $remote_addr;\n\
proxy_set_header Upgrade $http_upgrade;\n\
proxy_set_header Connection $connection_upgrade;\n\
proxy_http_version 1.1;\n\
\n\
add_header X-Cache $upstream_cache_status;\n\
proxy_ignore_headers Set-Cookie Cache-Control expires;\n\
add_header Cache-Control no-cache;\n\
\n\
set $static_files_app 0;\n\
{proxy_cache}\n\
}\n\
# PROXY-END"
tpl_proxy_cache = "\n\
if ( $uri ~* \"\.(gif|png|jpg|css|js|woff|woff2)$\" )\n\
{\n\
expires {cache_time}m;\n\
}\n\
proxy_ignore_headers Set-Cookie Cache-Control expires;\n\
proxy_cache mw_cache;\n\
proxy_cache_key \"$host$uri$is_args$args\";\n\
proxy_cache_valid 200 304 301 302 {cache_time}m;\n\
"
tpl_proxy_nocache = "\n\
set $static_files_app 0; \n\
if ( $uri ~* \"\.(gif|png|jpg|css|js|woff|woff2)$\" )\n\
{\n\
set $static_files_app 1;\n\
@@ -1952,8 +1986,7 @@ location ^~ {from} {\n\
{\n\
add_header Cache-Control no-cache;\n\
}\n\
}\n\
#PROXY-END"
"
# replace
if _from[0] != '/':
@@ -1961,28 +1994,69 @@ location ^~ {from} {\n\
tpl = tpl.replace("{from}", _from, 999)
tpl = tpl.replace("{to}", _to)
tpl = tpl.replace("{host}", _host, 999)
tpl = tpl.replace("{cache_time}", _cache_time, 999)
_id = mw.md5("{}+{}+{}".format(_from, _to, _siteName))
for item in data:
if item["id"] == _id:
return mw.returnJson(False, "已存在该规则!")
if item["from"] == _from:
return mw.returnJson(False, "代理目录已存在!")
data.append({
"from": _from,
"to": _to,
"host": _host,
"id": _id
})
if _open_cache == 'on':
tpl_proxy_cache = tpl_proxy_cache.replace(
"{cache_time}", _cache_time, 999)
tpl = tpl.replace("{proxy_cache}", tpl_proxy_cache, 999)
else:
tpl = tpl.replace("{proxy_cache}", tpl_proxy_nocache, 999)
proxy_action = 'add'
if _id == "":
_id = mw.md5("{}".format(_name))
else:
proxy_action = 'edit'
conf_proxy = "{}/{}.conf".format(self.getProxyPath(_siteName), _id)
conf_bk = "{}/{}.conf.txt".format(self.getProxyPath(_siteName), _id)
mw.writeFile(conf_proxy, tpl)
rule_test = mw.checkWebConfig()
if rule_test != True:
os.remove(conf_proxy)
return mw.returnJson(False, "OpenResty配置测试不通过, 请重试: {}".format(rule_test))
if proxy_action == "add":
# 添加代理
_id = mw.md5("{}".format(_name))
for item in data:
if item["name"] == _name:
return mw.returnJson(False, "名称重复!")
if item["from"] == _from:
return mw.returnJson(False, "代理目录已存在!")
data.append({
"name": _name,
"from": _from,
"to": _to,
"host": _host,
"open_cache": _open_cache,
"open_proxy": _open_proxy,
"cache_time": _cache_time,
"id": _id,
})
else:
# 修改代理
dindex = -1
for x in range(len(data)):
if data[x]["id"] == _id:
dindex = x
break
if dindex < 0:
return mw.returnJson(False, "异常请求")
data[dindex]['from'] = _from
data[dindex]['to'] = _to
data[dindex]['host'] = _host
data[dindex]['open_cache'] = _open_cache
data[dindex]['open_proxy'] = _open_proxy
data[dindex]['cache_time'] = _cache_time
conf_file = "{}/{}.conf".format(self.getProxyPath(_siteName), _id)
if _open_proxy != 'on':
conf_file = "{}/{}.conf.txt".format(
self.getProxyPath(_siteName), _id)
mw.writeFile(data_path, json.dumps(data))
mw.writeFile(conf_file, tpl)
os.rename(conf_proxy, conf_bk)
mw.writeFile(proxy_site_path, json.dumps(data))
self.operateProxyConf(_siteName, 'start')
mw.restartWeb()
return mw.returnJson(True, "ok", {"hash": _id})
@@ -2013,10 +2087,10 @@ location ^~ {from} {\n\
self.getProxyPath(_siteName), _id)
mw.execShell(cmd)
except:
return mw.returnJson(False, "删除失败!")
return mw.returnJson(False, "删除反代失败!")
mw.restartWeb()
return mw.returnJson(True, "删除成功!")
return mw.returnJson(True, "删除反代成功!")
def getSiteTypesApi(self):
# 取网站分类
@@ -2083,7 +2157,7 @@ location ^~ {from} {\n\
##### ----- end ----- ###
# 域名编码转换
# 域名编码转换
def toPunycode(self, domain):
import re
if sys.version_info[0] == 2:
@@ -2091,7 +2165,7 @@ location ^~ {from} {\n\
tmp = domain.split('.')
newdomain = ''
for dkey in tmp:
# 匹配非ascii字符
# 匹配非ascii字符
match = re.search(u"[\x80-\xff]+", dkey)
if not match:
newdomain += dkey + '.'
@@ -2646,7 +2720,7 @@ location ^~ {from} {\n\
mw.writeLog('TYPE_SITE', '设置成功,站点到期后将自动停止!', (siteName, edate))
return mw.returnJson(True, '设置成功,站点到期后将自动停止!')
# ssl相关方法 start
# ssl相关方法 start
def setSslConf(self, siteName):
file = self.getHostConf(siteName)
conf = mw.readFile(file)
@@ -2745,9 +2819,4 @@ location ^~ {from} {\n\
mw.execShell("chattr +i " + filename)
return mw.returnJson(True, '已打开防跨站设置!')
# 转换时间
def strfToTime(self, sdate):
import time
return time.strftime('%Y-%m-%d', time.strptime(sdate, '%b %d %H:%M:%S %Y %Z'))
# ssl相关方法 end
# ssl相关方法 end
+10
View File
@@ -755,6 +755,8 @@ class system_api:
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
P_VER=`python3 -V | awk '{print $2}'`
if [ ! -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && python3 -m venv .
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
@@ -769,6 +771,14 @@ if [ ! -z "$cn" ];then
fi
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
P_VER_D=`echo "$P_VER"|awk -F '.' '{print $1}'`
P_VER_M=`echo "$P_VER"|awk -F '.' '{print $2}'`
NEW_P_VER=${P_VER_D}.${P_VER_M}
if [ -f /www/server/mdserver-web/version/r${NEW_P_VER}.txt ];then
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/version/r${NEW_P_VER}.txt -i $PIPSRC
fi
'''
os.system(update_env)
self.restartMw()
+2 -2
View File
@@ -16,7 +16,7 @@ mw_start_task()
{
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "Starting mw-tasks... \c"
echo -e "starting mw-tasks... \c"
cd $DIR && python3 task.py >> ${DIR}/logs/task.log 2>&1 &
sleep 0.3
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
@@ -30,7 +30,7 @@ mw_start_task()
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting mw-tasks... mw-tasks (pid $(echo $isStart)) already running"
echo "starting mw-tasks... mw-tasks (pid $(echo $isStart)) already running"
fi
}
+20 -17
View File
@@ -16,6 +16,7 @@ cd /www/server/mdserver-web/plugins/php/versions && bash all_test.sh
| CentOS 9 Stream |✅ |✅ |
| Debian 10.3 |✅ |✅ |
| Debian 11.3 |✅ |✅ |
| Debian 12.0 |✅ |✅ |
| Ubuntu 18.04 |✅ |✅ |
| Ubuntu 20.04 |✅ |✅ |
| Ubuntu 22.04 |✅ |✅ |
@@ -28,23 +29,24 @@ cd /www/server/mdserver-web/plugins/php/versions && bash all_test.sh
| 系统名称 |PHP53 |PHP54 |PHP55 |PHP56 |PHP70 |PHP71 |PHP72 |PHP73 |PHP74 |PHP80 |PHP81 |
| ----------------- |-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| CentOS 7.9 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 8.4 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 8 Stream |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 9 Stream |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Debian 10.3 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Debian 11.3 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 18.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 20.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 22.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Fedora 31 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Fedora 32 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| AlmaLinux 9 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| RockyLinux 8.6 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Arch Linux |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| openSUSE 15.4 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| 系统名称 |PHP53 |PHP54 |PHP55 |PHP56 |PHP70 |PHP71 |PHP72 |PHP73 |PHP74 |PHP80 |PHP81 |PHP82 |
| ----------------- |-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|-------|
| CentOS 7.9 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 8.4 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 8 Stream |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| CentOS 9 Stream |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Debian 10.3 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Debian 11.3 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Debian 12 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 18.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 20.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Ubuntu 22.04 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Fedora 31 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Fedora 32 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| AlmaLinux 9 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| RockyLinux 8.6 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| Arch Linux |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
| openSUSE 15.4 |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |✅ |
@@ -56,6 +58,7 @@ cd /www/server/mdserver-web/plugins/php/versions && bash all_test.sh
| CentOS 9 Stream |✅ |✅ |✅ |✅ |
| Debian 10.3 |✅ |✅ |✅ |✅ |
| Debian 11.3 |✅ |✅ |✅ |✅ |
| Debian 12 |✅ |✅ |✅ |✅ |
| Ubuntu 18.04 |✅ |✅ |✅ |✅ |
| Ubuntu 20.04 |✅ |✅ |✅ |✅ |
| Ubuntu 22.04 |✅ |✅ |✅ |✅ |
+2 -3
View File
@@ -46,9 +46,8 @@ CREATE TABLE IF NOT EXISTS `firewall` (
INSERT INTO `firewall` (`id`, `port`, `ps`, `addtime`) VALUES
(1, '80', '网站默认端口', '0000-00-00 00:00:00'),
(2, '22', 'SSH远程管理服务', '0000-00-00 00:00:00'),
(3, '443', 'HTTPS', '0000-00-00 00:00:00'),
(4, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00');
(2, '443', 'HTTPS', '0000-00-00 00:00:00'),
(3, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00');
+2 -9
View File
@@ -39,20 +39,13 @@ server
allow all;
}
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
error_log off;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log {$LOGPATH}/{$SERVER_NAME}.log main;
error_log {$LOGPATH}/{$SERVER_NAME}.error.log;
}
+3 -10
View File
@@ -35,18 +35,11 @@ server
allow all;
}
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
error_log off;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
expires 30d;
}
access_log {$LOGPATH}/{$SERVER_MAIN}_{$DIRBIND}.log;
+40 -2
View File
@@ -1,10 +1,48 @@
<style type="text/css">
.docker-sub {
border-bottom: 1px solid #ccc;
height: 30px;
line-height: 30px;
margin-bottom: 15px;
}
.docker-sub .on {
border-bottom: 2px solid #20a53a;
color: #20a53a;
font-weight: bold;
font-family: "宋体";
}
.docker-sub span {
display: inline-block;
font-size: 14px;
height: 30px;
padding: 0 25px;
cursor: pointer;
}
.docker-environments {
resize: none;
width: 330px;
height: 80px;
line-height: 20px;
padding: 5px 8px;
border: 1px solid #ddd;
font-size: 12px;
}
</style>
<div class="bt-form">
<div class='plugin_version'></div>
<div class="bt-w-main">
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('docker');">服务</p>
<p onclick="pluginInitD('docker');">自启动</p>
<p onclick="dockerList();">容器列表</p>
<p onclick="dockerConList();">容器列表</p>
<p onclick="dockerImageList();">镜像列表</p>
<p onclick="dockerImageOutput();">镜像导出</p>
<p onclick="dockerIpList();">IP地址池</p>
<p onclick="repoList();">仓库</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>
@@ -12,7 +50,7 @@
</div>
</div>
<script type="text/javascript">
resetPluginWinWidth(700);
resetPluginWinWidth(800);
resetPluginWinHeight(400);
$.getScript( "/plugins/file?name=docker&f=js/docker.js", function(){
pluginService('docker', $('.plugin_version').attr('version'));
+705 -14
View File
@@ -5,15 +5,28 @@ import io
import os
import time
import re
import json
sys.path.append(os.getcwd() + "/class/core")
import mw
import docker
app_debug = False
if mw.isAppleSystem():
app_debug = True
def getDClient():
try:
client = docker.from_env()
except Exception as e:
client = docker.DockerClient(
base_url='unix:///Users/midoks/.docker/run/docker.sock')
return client
def getPluginName():
return 'docker'
@@ -26,12 +39,6 @@ def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
def getInitDFile():
if app_debug:
return '/tmp/' + getPluginName()
return '/etc/init.d/' + getPluginName()
def getConf():
path = getServerDir() + "/redis.conf"
return path
@@ -48,7 +55,7 @@ def getInitDTpl():
def getArgs():
args = sys.argv[3:]
args = sys.argv[2:]
tmp = {}
args_len = len(args)
@@ -57,19 +64,27 @@ def getArgs():
if t.strip() == '':
tmp = []
else:
t = t.split(':')
t = t.split(':', 1)
tmp[t[0]] = t[1]
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':')
t = args[i].split(':', 1)
tmp[t[0]] = t[1]
return tmp
def checkArgs(self, data, ck=[]):
for i in range(len(ck)):
print(data[i])
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def status():
data = mw.execShell(
"ps -ef|grep dockerd |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
"ps -ef|grep docker |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
if data[0] == '':
return 'stop'
@@ -138,9 +153,641 @@ def initdUinstall():
mw.execShell('systemctl disable ' + getPluginName())
return 'ok'
# UTC时间转换为时间戳
def runLog():
return getServerDir() + '/data/redis.log'
def utc_to_local(utc_time_str, utc_format='%Y-%m-%dT%H:%M:%S'):
import pytz
import datetime
import time
local_tz = pytz.timezone('Asia/Chongqing')
local_format = "%Y-%m-%d %H:%M"
utc_dt = datetime.datetime.strptime(utc_time_str, utc_format)
local_dt = utc_dt.replace(tzinfo=pytz.utc).astimezone(local_tz)
time_str = local_dt.strftime(local_format)
return int(time.mktime(time.strptime(time_str, local_format)))
def conList():
c = getDClient()
clist = c.containers.list(all=True)
conList = []
for con in clist:
tmp = con.attrs
tmp['Created'] = utc_to_local(tmp['Created'].split('.')[0])
conList.append(tmp)
return conList
def conListData():
try:
clist = conList()
except Exception as e:
return mw.returnJson(False, '未开启Docker')
return mw.returnJson(True, 'ok', clist)
def dockerRemoveCon():
args = getArgs()
data = checkArgs(args, ['Hostname'])
if not data[0]:
return data[1]
Hostname = args['Hostname']
c = getDClient()
try:
conFind = c.containers.get(Hostname)
try:
path_list = conFind.attrs['GraphDriver'][
'Data']['LowerDir'].split(':')
for i in path_list:
mw.execShell('chattr -R -i %s' % i)
except:
pass
conFind.remove(force=True)
return mw.returnJson(True, '成功删除!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '删除失败!' + str(ex))
def dockerLogCon():
args = getArgs()
data = checkArgs(args, ['Hostname'])
if not data[0]:
return data[1]
Hostname = args['Hostname']
c = getDClient()
try:
conFind = c.containers.get(Hostname)
if not conFind:
return mw.returnJson(False, 'The specified container does not exist!')
log = conFind.logs()
if not isinstance(log, str):
log = log.decode()
return mw.returnJson(True, log)
except docker.errors.APIError as ex:
return mw.returnJson(False, 'Get Logs failed')
def dockerRunCon():
# 启动容器
args = getArgs()
data = checkArgs(args, ['Hostname'])
if not data[0]:
return data[1]
Hostname = args['Hostname']
c = getDClient()
try:
conFind = c.containers.get(Hostname)
if not conFind:
return mw.returnJson(False, 'The specified container does not exist!')
conFind.start()
return mw.returnJson(True, '启动成功!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '启动失败!' + str(ex))
def dockerStopCon():
# 停止容器
args = getArgs()
data = checkArgs(args, ['Hostname'])
if not data[0]:
return data[1]
Hostname = args['Hostname']
c = getDClient()
try:
conFind = c.containers.get(Hostname)
if not conFind:
return mw.returnJson(False, 'The specified container does not exist!')
conFind.stop()
return mw.returnJson(True, '停止成功!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '停止失败!' + str(ex))
def dockerExec():
# 容器执行命令
args = getArgs()
data = checkArgs(args, ['Hostname'])
if not data[0]:
return data[1]
Hostname = args['Hostname']
debug_path = 'data/debug.pl'
if os.path.exists(debug_path):
return mw.returnJson(False, '开发模式不能进入!')
c = getDClient()
try:
conFind = c.containers.get(Hostname)
cmd = 'docker container exec -it %s /bin/sh' % Hostname
return mw.returnJson(True, cmd)
except docker.errors.APIError as ex:
return mw.returnJson(False, '连接失败!')
def imageList():
imageList = []
c = getDClient()
ilist = c.images.list()
for image in ilist:
tmp_attrs = image.attrs
if len(tmp_attrs['RepoTags']) == 1:
tmp_image = {}
tmp_image['Id'] = tmp_attrs['Id'].split(':')[1][:12]
tmp_image['RepoTags'] = tmp_attrs['RepoTags'][0]
tmp_image['Size'] = tmp_attrs['Size']
tmp_image['Labels'] = tmp_attrs['Config']['Labels']
tmp_image['Comment'] = tmp_attrs['Comment']
tmp_image['Created'] = utc_to_local(
tmp_attrs['Created'].split('.')[0])
imageList.append(tmp_image)
else:
for i in range(len(tmp_attrs['RepoTags'])):
tmp_image = {}
tmp_image['Id'] = tmp_attrs['Id'].split(':')[1][:12]
tmp_image['RepoTags'] = tmp_attrs['RepoTags'][i]
tmp_image['Size'] = tmp_attrs['Size']
tmp_image['Labels'] = tmp_attrs['Config']['Labels']
tmp_image['Comment'] = tmp_attrs['Comment']
tmp_image['Created'] = utc_to_local(
tmp_attrs['Created'].split('.')[0])
imageList.append(tmp_image)
imageList = sorted(imageList, key=lambda x: x['Created'], reverse=True)
return imageList
def dockerPull():
# pull Dockr 官方镜像
args = getArgs()
data = checkArgs(args, ['images'])
if not data[0]:
return data[1]
images = args['images']
if ':' in images:
pass
else:
images = images + ':latest'
c = getDClient()
try:
ret = c.images.pull(images)
if ret:
return mw.returnJson(True, '拉取成功!')
else:
return mw.returnJson(False, '拉取失败,请检查镜像名称或是否需要登录docker进行下载')
except:
ret = mw.execShell('docker image pull %s' % images)
if 'invalid' in ret[-1]:
return mw.returnJson(False, '拉取失败,请检查镜像名称或是否需要登录docker进行下载')
else:
return mw.returnJson(True, '拉取成功!')
def dockerPlulPath(path):
if not path and path == '':
return mw.returnJson(False, 'Invalid address')
ret = mw.execShell('docker image pull %s' % path)
if 'invalid' in ret[-1]:
return mw.returnJson(False, '拉取失败,请检查镜像名称或是否需要登录docker进行下载')
else:
return mw.returnJson(True, '拉取成功!')
def dockerPullReg():
# pull Dockr 官方镜像
args = getArgs()
data = checkArgs(args, ['path'])
if not data[0]:
return data[1]
path = args['path']
return dockerPlulPath(path)
# 判断镜像是否存在
def checkImage(path):
image_list = imageList()
for i in image_list:
if path == i["RepoTags"]:
return mw.returnData(False, '镜像已存在!')
def dockerPullPrivateNew():
# pull Dockr 官方镜像
args = getArgs()
data = checkArgs(args, ['path'])
if not data[0]:
return data[1]
path = args['path']
check = checkImage(path)
if check:
return mw.getJson(check)
my_repo = repoList()
if not my_repo:
return mw.returnJson(False, '未登录任何私人存储库,请登录然后拉取')
return dockerPlulPath(path)
def imageListData():
try:
ilist = imageList()
except Exception as e:
return mw.returnJson(False, '未开启Docker')
return mw.returnJson(True, 'ok', ilist)
def dockerRemoveImage():
args = getArgs()
data = checkArgs(args, ['imageId', 'repoTags'])
if not data[0]:
return data[1]
repoTags = args['repoTags']
imageId = args['imageId']
c = getDClient()
try:
c.images.remove(repoTags)
return mw.returnJson(True, '成功删除')
except:
try:
c.images.remove(imageId)
return mw.returnJson(True, '成功删除!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '删除失败, 当前镜像正在使用!')
def getImageListFunc(dbname=''):
bkDir = mw.getRootDir() + '/backup/docker'
blist = os.listdir(bkDir)
r = []
bname = 'db_' + dbname
blen = len(bname)
for x in blist:
fbstr = x[0:blen]
if fbstr == bname:
r.append(x)
return r
def dockerImagePickDir():
bkDir = mw.getRootDir() + '/backup/docker'
return mw.returnJson(True, 'ok', bkDir)
def dockerImagePickList():
bkDir = mw.getRootDir() + '/backup/docker'
if not os.path.exists(bkDir):
os.mkdir(bkDir)
r = os.listdir(bkDir)
rr = []
for x in range(0, len(r)):
p = bkDir + '/' + r[x]
data = {}
data['name'] = r[x]
rsize = os.path.getsize(p)
data['size'] = mw.toSize(rsize)
t = os.path.getctime(p)
t = time.localtime(t)
data['time'] = time.strftime('%Y-%m-%d %H:%M:%S', t)
rr.append(data)
data['file'] = p
return mw.returnJson(True, 'ok', rr)
def dockerImagePickSave():
# image 导出
args = getArgs()
data = checkArgs(args, ['images'])
if not data[0]:
return data[1]
bkDir = mw.getRootDir() + '/backup/docker/'
images = args['images']
try:
file_name = bkDir + \
str(time.strftime('%Y%m%d_%H%M%S', time.localtime())) + '.tar.gz'
mw.execShell('docker image save %s | gzip > %s' %
(images, file_name))
return mw.returnJson(True, '导出镜像 {} 成功!'.format(file_name))
except docker.errors.APIError as ex:
return mw.returnJson(False, '操作失败: ' + str(ex))
def dockerImagePickLoad():
# 镜像文件导入
args = getArgs()
data = checkArgs(args, ['file'])
if not data[0]:
return data[1]
try:
file_path = args['file']
if not os.path.exists(file_path):
return mw.returnJson(False, '文件不存在')
if file_path.endswith('.tar'):
mw.execShell('docker image load < %s' % file_path)
elif file_path.endswith('.tar.gz'):
mw.execShell('gunzip -c %s | docker image load' % file_path)
else:
return mw.returnJson(False, '不支持改文件类型!')
return mw.returnJson(True, '导入镜像文件成功!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '操作失败: ' + str(ex))
def dockerLoginCheck(user_name, user_pass, registry):
# 登陆验证
cmd = 'docker login -u=%s -p %s %s' % (user_name, user_pass, registry)
# print(cmd)
login_test = mw.execShell(cmd)
# print(login_test)
ret = 'required$|Error'
ret2 = re.findall(ret, login_test[-1])
if len(ret2) == 0:
return True
else:
return False
def getDockerIpListData():
# 取IP列表
path = getServerDir()
ipConf = path + '/iplist.json'
if not os.path.exists(ipConf):
return []
iplist = json.loads(mw.readFile(ipConf))
return iplist
def getDockerIpList():
data = getDockerIpListData()
return mw.returnJson(True, 'ok!', data)
def dockerAddIP():
# 添加IP
args = getArgs()
data = checkArgs(args, ['address', 'netmask', 'gateway'])
if not data[0]:
return data[1]
path = getServerDir()
ipConf = path + '/iplist.json'
if not os.path.exists(ipConf):
iplist = []
mw.writeFile(ipConf, json.dumps(iplist))
iplist = json.loads(mw.readFile(ipConf))
ipInfo = {
'address': args['address'],
'netmask': args['netmask'],
'gateway': args['gateway'],
}
iplist.append(ipInfo)
mw.writeFile(ipConf, json.dumps(iplist))
return mw.returnJson(True, '添加成功!')
def dockerDelIP():
# 删除IP
args = getArgs()
data = checkArgs(args, ['address'])
if not data[0]:
return data[1]
path = getServerDir()
ipConf = path + '/iplist.json'
if not os.path.exists(ipConf):
return mw.returnJson(False, '指定的IP不存在。!')
iplist = json.loads(mw.readFile(ipConf))
newList = []
for ipInfo in iplist:
if ipInfo['address'] == args['address']:
continue
newList.append(ipInfo)
mw.writeFile(ipConf, json.dumps(newList))
return mw.returnJson(True, '成功删除!')
def getDockerCreateInfo():
# 取创建依赖
import psutil
data = {}
data['images'] = imageList()
data['memSize'] = int(psutil.virtual_memory().total / 1024 / 1024)
data['iplist'] = getDockerIpListData()
return mw.returnJson(True, 'ok!', data)
def __release_port(port):
from collections import namedtuple
try:
import firewall_api
firewall_api.firewall_api().addAcceptPortArgs(port, 'docker', 'port')
return port
except Exception as e:
return "Release failed {}".format(e)
def dockerPortCheck():
args = getArgs()
data = checkArgs(args, ['port'])
if not data[0]:
return data[1]
port = args['port']
is_ok = IsPortExists(port)
if is_ok:
return mw.returnJson(True, 'ok')
return mw.returnJson(False, 'fail')
def IsPortExists(port):
# 判断端口是否被占用
ret = __check_dst_port(ip='localhost', port=port)
ret2 = __check_dst_port(ip='0.0.0.0', port=port)
if ret:
return ret
if not ret and ret2:
return ret2
if not ret and not ret2:
return False
def __check_dst_port(ip, port, timeout=3):
# 端口检测
import socket
ok = True
try:
s = socket.socket()
s.settimeout(timeout)
s.connect((ip, port))
s.close()
except:
ok = False
return ok
def dockerCreateCon():
args = getArgs()
data = checkArgs(args, ['environments', 'command',
'entrypoint', 'image', 'mem_limit', 'ports', 'volumes'])
if not data[0]:
return data[1]
environments = args['environments']
environments = environments.strip().split()
command = args['command']
entrypoint = args['entrypoint']
image = args['image']
mem_limit = args['mem_limit']
ports = args['ports']
ports = ports.replace('[', '(').replace(']', ')')
volumes = args['volumes']
# if __name__ == "__main__":
# print(args)
try:
c = getDClient()
conObject = c.containers.run(
image=image,
mem_limit=mem_limit + 'M',
ports=eval(ports),
auto_remove=False,
command=command,
detach=True,
stdin_open=True,
tty=True,
entrypoint=entrypoint,
privileged=True,
volumes=json.loads(volumes),
cpu_shares=10,
environment=environments
)
if conObject:
__release_port(ports)
return mw.returnJson(True, '创建成功!')
return mw.returnJson(False, '创建失败!')
except docker.errors.APIError as ex:
return mw.returnJson(False, '创建失败!' + str(ex))
def dockerLogin():
args = getArgs()
# print(args)
data = checkArgs(args, ['user', 'passwd', 'hub_name',
'namespace', 'registry', 'repository_name'])
if not data[0]:
return data[1]
user_name = args['user']
user_pass = args['passwd']
registry = args['registry']
hub_name = args['hub_name']
namespace = args['namespace']
repository_name = args['repository_name']
ret_status = dockerLoginCheck(user_name, user_pass, registry)
path = getServerDir()
if ret_status:
user_file = path + '/user.json'
user_info = mw.readFile(user_file)
if not user_info:
user_info = []
else:
user_info = json.loads(user_info)
ret = {}
ret['user_name'] = user_name
ret['user_pass'] = user_pass
ret['registry'] = registry
ret['hub_name'] = hub_name
ret['namespace'] = namespace
ret['repository_name'] = repository_name
if not registry:
ret['registry'] = "docker.io"
user_info.append(ret)
mw.writeFile(user_file, json.dumps(user_info))
return mw.returnJson(True, '成功登录!')
return mw.returnJson(False, '登录失败!')
# 删除用户信息
def delete_user_info(registry):
path = getServerDir()
user_file = path + '/user.json'
user_info = mw.readFile(user_file)
if user_info:
user_info = json.loads(user_info)
for i in range(len(user_info)):
if registry in user_info[i].values():
del(user_info[i])
mw.writeFile(user_file, json.dumps(user_info))
return True
def dockerLogout():
args = getArgs()
data = checkArgs(args, ['registry'])
if not data[0]:
return data[1]
registry = args['registry']
if registry == "docker.io":
registry = ""
login_test = mw.execShell('docker logout %s' % registry)
if registry == "":
registry = "docker.io"
ret = 'required$|Error'
ret2 = re.findall(ret, login_test[-1])
delete_user_info(registry)
if len(ret2) == 0:
return mw.returnJson(True, '退出成功')
else:
return mw.returnJson(True, '退出失败')
def repoList():
path = getServerDir()
repostory_info = []
user_file = path + '/user.json'
if os.path.exists(user_file):
user_info = mw.readFile(user_file)
user_info = json.loads(user_info)
for i in user_info:
tmp = {}
tmp["hub_name"] = i["hub_name"]
tmp["registry"] = i["registry"]
tmp["namespace"] = i["namespace"]
tmp['repository_name'] = i["repository_name"]
repostory_info.append(tmp)
return mw.returnJson(True, 'ok', repostory_info)
if __name__ == "__main__":
@@ -163,7 +810,51 @@ if __name__ == "__main__":
print(initdUinstall())
elif func == 'conf':
print(getConf())
elif func == 'run_log':
print(runLog())
elif func == 'con_list':
print(conListData())
elif func == 'docker_con_log':
print(dockerLogCon())
elif func == 'docker_remove_con':
print(dockerRemoveCon())
elif func == 'docker_run_con':
print(dockerRunCon())
elif func == 'docker_stop_con':
print(dockerStopCon())
elif func == 'docker_exec':
print(dockerExec())
elif func == 'docker_pull':
print(dockerPull())
elif func == 'docker_pull_reg':
print(dockerPullReg())
elif func == 'image_list':
print(imageListData())
elif func == 'image_pick_dir':
print(dockerImagePickDir())
elif func == 'image_pick_save':
print(dockerImagePickSave())
elif func == 'image_pick_load':
print(dockerImagePickLoad())
elif func == 'image_pick_list':
print(dockerImagePickList())
elif func == 'docker_get_iplist':
print(getDockerIpList())
elif func == 'docker_del_ip':
print(dockerDelIP())
elif func == 'docker_add_ip':
print(dockerAddIP())
elif func == 'get_docker_create_info':
print(getDockerCreateInfo())
elif func == 'docker_create_con':
print(dockerCreateCon())
elif func == 'docker_remove_image':
print(dockerRemoveImage())
elif func == 'docker_port_check':
print(dockerPortCheck())
elif func == 'docker_login':
print(dockerLogin())
elif func == 'docker_logout':
print(dockerLogout())
elif func == 'repo_list':
print(repoList())
else:
print('error')
+2 -1
View File
@@ -1,6 +1,6 @@
{
"sort": 7,
"ps": "Docker 是一个开源的应用容器引擎(开发测试中)",
"ps": "Docker是一个开源的应用容器引擎",
"name": "docker",
"title": "Docker",
"shell": "install.sh",
@@ -13,6 +13,7 @@
"author": "Zend",
"date": "2017-04-01",
"home": "https://docker.io",
"doc1":"https://docker-py.readthedocs.io/",
"type": 0,
"pid": "2"
}
+12 -5
View File
@@ -13,13 +13,17 @@ serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
VERSION=$2
if [ -f ${rootPath}/bin/activate ];then
source ${rootPath}/bin/activate
fi
Install_Docker()
{
which docker
if [ "$?" == "0" ];then
echo '安装已经完成docker' > $install_tmp
exit 0
fi
# which docker
# if [ "$?" == "0" ];then
# echo '安装已经完成docker' > $install_tmp
# exit 0
# fi
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/source
@@ -28,6 +32,9 @@ Install_Docker()
curl -fsSL https://get.docker.com | bash
mkdir -p $serverPath/docker
fi
pip install docker
pip install pytz
if [ -d $serverPath/docker ];then
echo "${VERSION}" > $serverPath/docker/version.pl
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -739,7 +739,7 @@ def importDbBackup():
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
sock = getSocketFile()
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \
mysql_cmd = getServerDir() + '/bin/mariadb -S ' + sock + ' -uroot -p' + pwd + \
' ' + name + ' < ' + file_path_sql
# print(mysql_cmd)
@@ -800,7 +800,7 @@ def importDbExternal():
sock = getSocketFile()
os.environ["MYSQL_PWD"] = pwd
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + \
mysql_cmd = getServerDir() + '/bin/mariadb -S ' + sock + ' -uroot -p' + \
pwd + ' ' + name + ' < ' + import_sql
# print(mysql_cmd)
+1 -1
View File
@@ -39,7 +39,7 @@ max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
skip-name-resolve=1
skip_name_resolve=1
#skip-grant-tables
#skip-networking
#skip-external-locking
+1 -1
View File
@@ -41,7 +41,7 @@ max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
skip-name-resolve=1
skip_name_resolve=1
#skip-grant-tables
#skip-networking
#skip-external-locking
+1 -1
View File
@@ -41,7 +41,7 @@ max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M
skip_name_resolve = 1
skip_name_resolve=1
skip-ssl
#skip-networking
#skip-external-locking
+3 -3
View File
@@ -8,8 +8,8 @@ default-character-set = UTF8MB4
[mysqld]
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
sha256_password_private_key_path=mysql.pem
sha256_password_public_key_path=mysql.pub
sha256_password_private_key_path={$SERVER_APP_PATH}/data/mysql.pem
sha256_password_public_key_path={$SERVER_APP_PATH}/data/mysql.pub
authentication_policy=mysql_native_password
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
@@ -40,7 +40,7 @@ max_connect_errors = 100
open_files_limit = 2560
max_allowed_packet = 128M
skip_name_resolve = 1
skip_name_resolve=1
#skip-networking
#skip-external-locking
#loose-skip-innodb
+21 -10
View File
@@ -167,7 +167,6 @@ def pMysqlDb():
def makeInitRsaKey(version=''):
datadir = getServerDir() + "/data"
mysql_pem = datadir + "/mysql.pem"
if not os.path.exists(mysql_pem):
rdata = mw.execShell(
@@ -176,12 +175,11 @@ def makeInitRsaKey(version=''):
rdata = mw.execShell(
'cd ' + datadir + ' && openssl rsa -in mysql.pem -pubout -out mysql.pub')
# print(rdata)
if not mw.isAppleSystem():
mw.execShell('cd ' + datadir + ' && chmod 400 mysql.pem')
mw.execShell('cd ' + datadir + ' && chmod 444 mysql.pub')
mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pem')
mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pub')
if not mw.isAppleSystem():
mw.execShell('cd ' + datadir + ' && chmod 400 mysql.pem')
mw.execShell('cd ' + datadir + ' && chmod 444 mysql.pub')
mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pem')
mw.execShell('cd ' + datadir + ' && chown mysql:mysql mysql.pub')
def initDreplace(version=''):
@@ -251,6 +249,14 @@ def initDreplace(version=''):
return file_bin
def process_status():
cmd = "ps -ef|grep mysql |grep -v grep | grep -v python | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def status(version=''):
path = getConf()
if not os.path.exists(path):
@@ -450,7 +456,7 @@ def initMysqlPwd():
def initMysql8Pwd():
time.sleep(2)
time.sleep(8)
serverdir = getServerDir()
myconf = serverdir + "/etc/my.cnf"
@@ -540,7 +546,12 @@ def my8cmd(version, method):
else:
mw.execShell('systemctl start mysql')
initMysql8Pwd()
for x in range(10):
mydb_status = process_status()
if mydb_status == 'start':
initMysql8Pwd()
break
time.sleep(1)
if mw.isAppleSystem():
cmd_init_stop = init_file + ' stop'
@@ -562,11 +573,11 @@ def my8cmd(version, method):
def appCMD(version, action):
makeInitRsaKey(version)
if version == '8.0' or version == '5.7':
status = my8cmd(version, action)
else:
status = myOp(version, action)
makeInitRsaKey(version)
return status
+1 -1
View File
@@ -181,7 +181,7 @@ function changeMySQLDataPath(act) {
$.post('/database?action=GetMySQLInfo', '', function(rdata) {
var LimitCon = '<p class="conf_p">\
<input id="datadir" class="phpUploadLimit bt-input-text mr5" style="width:350px;" type="text" value="' + rdata.datadir + '" name="datadir">\
<span onclick="ChangePath(\'datadir\')" class="glyphicon glyphicon-folder-open cursor mr20" style="width:auto"></span><button class="btn btn-success btn-sm" onclick="changeMySQLDataPath(1)">' + lan.soft.mysql_to + '</button>\
<span onclick="changePath(\'datadir\')" class="glyphicon glyphicon-folder-open cursor mr20" style="width:auto"></span><button class="btn btn-success btn-sm" onclick="changeMySQLDataPath(1)">' + lan.soft.mysql_to + '</button>\
</p>';
$(".soft-man-con").html(LimitCon);
});
+1
View File
@@ -86,6 +86,7 @@ Install_mysql()
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mysql ];then
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '5.5' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
+1
View File
@@ -105,6 +105,7 @@ Install_mysql()
if [ -d $serverPath/mysql ];then
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '5.6' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
+1
View File
@@ -118,6 +118,7 @@ Install_mysql()
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mysql ];then
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '5.7' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
+1
View File
@@ -210,6 +210,7 @@ Install_mysql()
make -j${cpuCore} && make install && make clean
if [ -d $serverPath/mysql ];then
rm -rf ${mysqlDir}/mysql-${VERSION}
echo '8.0' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

+26
View File
@@ -0,0 +1,26 @@
<div class="bt-form">
<div class="bt-w-main">
<div class='plugin_version'></div>
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('nezha',$('.plugin_version').attr('version'));">面板服务</p>
<p onclick="pluginInitD('nezha',$('.plugin_version').attr('version'));">面板自启动</p>
<p onclick="nezha.cfg($('.plugin_version').attr('version'));">面板配置</p>
<p onclick="pluginConfig('nezha', $('.plugin_version').attr('version'), 'conf');">面板配置文件</p>
<p onclick="pluginService('nezha', $('.plugin_version').attr('version'), 'agent');">AGENT服务</p>
<p onclick="pluginInitD('nezha', $('.plugin_version').attr('version'), 'agent');">AGENT自启动</p>
<p onclick="nezha.agent_cfg($('.plugin_version').attr('version'));">AGENT配置</p>
<p onclick="nezha.readme();">说明</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>
</div>
</div>
</div>
<script type="text/javascript">
resetPluginWinHeight(530);
$.getScript( "/plugins/file?name=nezha&f=js/nezha.js", function(){
nezha.init();
pluginService('nezha');
});
</script>
+364
View File
@@ -0,0 +1,364 @@
# coding:utf-8
import sys
import io
import os
import time
import re
import socket
import json
from datetime import datetime
sys.path.append(os.getcwd() + "/class/core")
import mw
app_debug = False
if mw.isAppleSystem():
app_debug = True
class App:
__setupPath = '/www/server/nezha'
__cfg = ''
__agent_cfg = ''
def __init__(self):
self.__setupPath = self.getServerDir()
self.__cfg = self.__setupPath + '/nezha.cfg'
self.__agent_cfg = self.__setupPath + '/agent.cfg'
def getArgs(self):
args = sys.argv[3:]
tmp = {}
args_len = len(args)
if args_len == 1:
t = args[0].strip('{').strip('}')
t = t.split(':', 1)
tmp[t[0]] = t[1]
elif args_len > 1:
for i in range(len(args)):
t = args[i].split(':', 1)
tmp[t[0]] = t[1]
return tmp
def checkArgs(self, data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def __release_port(self, port):
from collections import namedtuple
try:
import firewall_api
firewall_api.firewall_api().addAcceptPortArgs(port, 'nezha', 'port')
return port
except Exception as e:
return "Release failed {}".format(e)
def openPort(self):
for i in ["9527", "5555"]:
self.__release_port(i)
return True
def getPluginName(self):
return 'nezha'
def getPluginDir(self):
return mw.getPluginDir() + '/' + self.getPluginName()
def getServerDir(self):
return mw.getServerDir() + '/' + self.getPluginName()
def getInitdConfTpl(self):
path = self.getPluginDir() + "/init.d/nezha.tpl"
return path
def getInitdAgentConfTpl(self):
path = self.getPluginDir() + "/init.d/nezha-agent.tpl"
return path
def getHomeDir(self):
if mw.isAppleSystem():
user = mw.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
return '/Users/' + user
else:
return '/root'
def getRunUser(self):
if mw.isAppleSystem():
user = mw.execShell(
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
return user
else:
return 'root'
def status(self):
cmd = "ps -ef|grep " + self.getPluginName() + \
" |grep -v grep | grep -v nezha-agent | grep -v python | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return "stop"
return 'start'
def status_agent(self):
cmd = "ps -ef | grep nezha-agent | grep -v grep | grep -v python | awk '{print $2}'"
data = mw.execShell(cmd)
if data[0] == '':
return 'stop'
return 'start'
def contentReplace(self, content):
service_path = mw.getServerDir()
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
content = content.replace('{$SERVER_PATH}', service_path)
content = content.replace('{$RUN_USER}', self.getRunUser())
content = content.replace('{$HOME_DIR}', self.getHomeDir())
return content
def initDreplace(self):
file_tpl = self.getInitdConfTpl()
service_path = mw.getServerDir()
initD_path = self.getServerDir() + '/init.d'
if not os.path.exists(initD_path):
os.mkdir(initD_path)
self.openPort()
file_bin = initD_path + '/' + self.getPluginName()
if not os.path.exists(file_bin):
content = mw.readFile(file_tpl)
content = self.contentReplace(content)
mw.writeFile(file_bin, content)
mw.execShell('chmod +x ' + file_bin)
# systemd
systemDir = mw.systemdCfgDir()
systemService = systemDir + '/nezha.service'
systemServiceTpl = self.getPluginDir() + '/init.d/nezha.service.tpl'
if os.path.exists(systemDir) and not os.path.exists(systemService):
service_path = mw.getServerDir()
se_content = mw.readFile(systemServiceTpl)
se_content = self.contentReplace(se_content)
mw.writeFile(systemService, se_content)
mw.execShell('systemctl daemon-reload')
return file_bin
def contentAgentReplace(self, content):
path = self.__agent_cfg
if os.path.exists(path):
data = self.get_agent_cfg()
content = content.replace('{$APP_HOST}', data['host'])
content = content.replace('{$APP_SECRET}', data['secret'])
return content
def initDAgent(self):
file_tpl = self.getInitdAgentConfTpl()
initD_path = self.getServerDir() + '/init.d'
if not os.path.exists(initD_path):
os.mkdir(initD_path)
file_agent_bin = initD_path + '/nezha-agent'
content = mw.readFile(file_tpl)
content = self.contentReplace(content)
content = self.contentAgentReplace(content)
mw.writeFile(file_agent_bin, content)
mw.execShell('chmod +x ' + file_agent_bin)
# systemd
sysDir = mw.systemdCfgDir()
sysService = sysDir + '/nezha-agent.service'
sysServiceTpl = self.getPluginDir() + '/init.d/nezha-agent.service.tpl'
service_path = mw.getServerDir()
content = mw.readFile(sysServiceTpl)
content = self.contentReplace(content)
content = self.contentAgentReplace(content)
mw.writeFile(sysService, content)
mw.execShell('systemctl daemon-reload')
return file_agent_bin
def init_cfg(self):
self.initDreplace()
self.initDAgent()
def imOp(self, method):
file = self.initDreplace()
if not mw.isAppleSystem():
cmd = 'systemctl {} {}'.format(method, self.getPluginName())
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
data = mw.execShell(file + ' ' + method)
if data[1] == '':
return 'ok'
return data[0]
def start(self):
return self.imOp('start')
def stop(self):
return self.imOp('stop')
def restart(self):
return self.imOp('restart')
def reload(self):
return self.imOp('reload')
def agOp(self, method):
file = self.initDAgent()
path = self.__agent_cfg
if not os.path.exists(path):
return '请先设置Agent配置!'
if not mw.isAppleSystem():
cmd = 'systemctl {} {}'.format(method, 'nezha-agent')
data = mw.execShell(cmd)
if data[1] == '':
return 'ok'
return 'fail'
data = mw.execShell(file + ' ' + method)
if data[1] == '':
return 'ok'
return data[0]
def start_agent(self):
return self.agOp('start')
def stop_agent(self):
return self.agOp('stop')
def restart_agent(self):
return self.agOp('restart')
def reload_agent(self):
return self.agentOp('reload')
def initd_status(self):
cmd = 'systemctl status nezha | grep loaded | grep "enabled;"'
data = mw.execShell(cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initd_install(self):
mw.execShell('systemctl enable nezha')
return 'ok'
def initd_uninstall(self):
mw.execShell('systemctl disable nezha')
return 'ok'
def initd_status_agent(self):
cmd = 'systemctl status nezha-agent | grep loaded | grep "enabled;"'
data = mw.execShell(cmd)
if data[0] == '':
return 'fail'
return 'ok'
def initd_install_agent(self):
mw.execShell('systemctl enable nezha-agent')
return 'ok'
def initd_uninstall_agent(self):
mw.execShell('systemctl disable nezha-agent')
return 'ok'
def conf(self):
return self.getServerDir() + '/dashboard/data/config.yaml'
def nezha_cfg(self):
path = self.__cfg
if not os.path.exists(path):
d = {}
cmd_un = 'cd ' + self.getServerDir() + '/dashboard && ./nezha conf -u ""'
mw.execShell(cmd_un)
td = mw.execShell(cmd_un)
d['username'] = td[0].strip()
pwd = mw.getRandomString(16)
cmd_pwd = 'cd ' + self.getServerDir() + '/dashboard && ./nezha conf -u "" -p ' + pwd
td = mw.execShell(cmd_pwd)
d['password'] = pwd
mw.writeFile(path, mw.enDoubleCrypt('nezha', mw.getJson(d)))
info = mw.readFile(path)
info = mw.deDoubleCrypt('nezha', info)
info = json.loads(info)
return mw.returnJson(True, 'ok', info)
def nezha_save_cfg(self):
args = self.getArgs()
data = self.checkArgs(args, ['username', 'password'])
if not data[0]:
return data[1]
path = self.__cfg
cmd = 'cd ' + self.getServerDir() + '/dashboard && ./nezha conf -su "' + \
args['username'] + '" -p ' + args['password']
# print(cmd)
t = mw.execShell(cmd)
# print(t)
mw.writeFile(path, mw.enDoubleCrypt('nezha', mw.getJson(args)))
return mw.returnJson(True, '修改成功!')
def get_agent_cfg(self):
path = self.__agent_cfg
info = mw.readFile(path)
info = mw.deDoubleCrypt('agent', info)
info = json.loads(info)
return info
def agent_cfg(self):
path = self.__agent_cfg
if not os.path.exists(path):
d = {}
d['host'] = '127.0.0.1:5555'
d['secret'] = 'secret'
mw.writeFile(path, mw.enDoubleCrypt('agent', mw.getJson(d)))
info = self.get_agent_cfg()
return mw.returnJson(True, 'ok', info)
def agent_save_cfg(self):
args = self.getArgs()
data = self.checkArgs(args, ['host', 'secret'])
if not data[0]:
return data[1]
path = self.__agent_cfg
mw.writeFile(path, mw.enDoubleCrypt('agent', mw.getJson(args)))
return mw.returnJson(True, '修改成功!')
def run_log(self):
return self.getServerDir() + '/logs/nezha.log'
if __name__ == "__main__":
func = sys.argv[1]
classApp = App()
try:
data = eval("classApp." + func + "()")
print(data)
except Exception as e:
print('error:' + str(e))
+18
View File
@@ -0,0 +1,18 @@
{
"sort": 7,
"ps": "哪吒监控面板/改造版",
"name": "nezha",
"title": "哪吒监控",
"shell": "install.sh",
"versions":["0.15.2"],
"tip": "soft",
"checks": "server/nezha",
"path": "server/nezha",
"display": 1,
"author": "midoks",
"date": "2023-06-26",
"home": "https://github.com/midoks/nezha",
"doc1": "https://nezha.wiki/",
"type": 0,
"pid": "5"
}
@@ -0,0 +1,30 @@
[Unit]
Description=Nezha Agent
After=syslog.target
#After=network.target
#After=nezha-dashboard.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory={$SERVER_PATH}/nezha/agent/
ExecStart={$SERVER_PATH}/nezha/agent/nezha-agent -s {$APP_HOST} -p {$APP_SECRET}
Restart=always
#Environment=DEBUG=true
# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
#ProtectSystem=full
#PrivateDevices=yes
#PrivateTmp=yes
#NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
+90
View File
@@ -0,0 +1,90 @@
#!/bin/bash
# chkconfig: 2345 55 25
# description: Nezha Agent Service
### BEGIN INIT INFO
# Provides: Nezha Agent
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts Nezha Agent
# Description: starts the Nezha Agent
### END INIT INFO
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
if [ -f /etc/init.d/functions ];then
. /etc/init.d/functions
fi
if [ -f /etc/rc.d/init.d/functions ];then
. /etc/rc.d/init.d/functions
fi
SERVICENAME=nezha-agent
LOG_PATH={$SERVER_PATH}/nezha/logs
APP_PATH={$SERVER_PATH}/nezha/agent
APP_HOST={$APP_HOST}
APP_SECRET={$APP_SECRET}
app_start(){
isStart=`ps -ef|grep "${SERVICENAME}" | grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "Starting ${SERVICENAME}... \c"
cd $APP_PATH
exec nohup ${APP_PATH}/${SERVICENAME} -d -s ${APP_HOST} -p ${APP_SECRET} >> ${LOG_PATH}/${SERVICENAME}.log 2>&1 &
isStart=""
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
isStart=$(ps -ef|grep "${SERVICENAME}" |grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}')
let n+=1
if [ $n -gt 15 ];then
break;
fi
done
if [ "$isStart" == '' ];then
echo -e "\033[31mError: ${SERVICENAME} service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting ${SERVICENAME}(pid $(echo $isStart)) already running"
fi
}
app_stop(){
pids=`ps -ef | grep "${SERVICENAME}" | grep -v grep | grep -v python | grep -v "/bin/bash" |awk '{print $2}'`
arr=($pids)
echo -e "Stopping ${SERVICENAME}... \c"
for p in ${arr[@]}
do
# echo "$p"
kill -9 $p
done
echo -e "\033[32mdone\033[0m"
}
app_status(){
isStart=`ps -ef | grep "${SERVICENAME}" | grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "${SERVICENAME} not running"
else
echo -e "${SERVICENAME}(pid $(echo $isStart)) already running"
fi
}
case "$1" in
'start') app_start;;
'stop') app_stop;;
'status') app_status;;
'reload')
app_stop
app_start;;
'restart')
app_stop
app_start;;
esac
+30
View File
@@ -0,0 +1,30 @@
[Unit]
Description=Nezha Dashborad
After=syslog.target
After=network.target
After=mariadb.service mysqld.service postgresql.service memcached.service redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
#User=root
#Group=root
WorkingDirectory={$SERVER_PATH}/nezha/dashboard/
ExecStart={$SERVER_PATH}/nezha/dashboard/nezha web
Restart=always
#Environment=DEBUG=true
# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target
+87
View File
@@ -0,0 +1,87 @@
#!/bin/bash
# chkconfig: 2345 55 25
# description: Nezha Service
### BEGIN INIT INFO
# Provides: Nezha
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts Nezha
# Description: starts the Nezha
### END INIT INFO
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
if [ -f /etc/init.d/functions ];then
. /etc/init.d/functions
fi
if [ -f /etc/rc.d/init.d/functions ];then
. /etc/rc.d/init.d/functions
fi
SERVICENAME=nezha
LOG_PATH={$SERVER_PATH}/${SERVICENAME}/logs
APP_PATH={$SERVER_PATH}/${SERVICENAME}/dashboard
app_start(){
isStart=`ps -ef|grep "${SERVICENAME} web" | grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "Starting ${SERVICENAME}... \c"
cd $APP_PATH && exec nohup ${APP_PATH}/${SERVICENAME} web >> ${LOG_PATH}/${SERVICENAME}.log 2>&1 &
isStart=""
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
isStart=$(ps -ef|grep "${SERVICENAME} web" |grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}')
let n+=1
if [ $n -gt 15 ];then
break;
fi
done
if [ "$isStart" == '' ];then
echo -e "\033[31mError: ${SERVICENAME} service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting ${SERVICENAME}(pid $(echo $isStart)) already running"
fi
}
app_stop(){
pids=`ps -ef | grep "${SERVICENAME} web" | grep -v grep | grep -v python | grep -v "/bin/bash" |awk '{print $2}'`
arr=($pids)
echo -e "Stopping ${SERVICENAME}... \c"
for p in ${arr[@]}
do
# echo "$p"
kill -9 $p
done
echo -e "\033[32mdone\033[0m"
}
app_status(){
isStart=`ps -ef | grep "${SERVICENAME} web" | grep -v grep | grep -v python | grep -v "/bin/bash" | awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "${SERVICENAME} not running"
else
echo -e "${SERVICENAME}(pid $(echo $isStart)) already running"
fi
}
case "$1" in
'start') app_start;;
'stop') app_stop;;
'status') app_status;;
'reload')
app_stop
app_start;;
'restart')
app_stop
app_start;;
esac
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
action=$1
type=$2
if [ "${2}" == "" ];then
echo '缺少安装脚本...' > $install_tmp
exit 0
fi
if [ ! -d $curPath/versions/$2 ];then
echo '缺少安装脚本2...' > $install_tmp
exit 0
fi
sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "uninstall" ];then
if [ -f /usr/lib/systemd/system/nezha.service ] || [ -f /lib/systemd/system/nezha.service ] ;then
systemctl stop nezha
systemctl disable nezha
rm -rf /usr/lib/systemd/system/nezha.service
rm -rf /lib/systemd/system/nezha.service
systemctl daemon-reload
fi
if [ -f /usr/lib/systemd/system/nezha-agent.service ] || [ -f /lib/systemd/system/nezha-agent.service ] ;then
systemctl stop nezha-agent
systemctl disable nezha-agent
rm -rf /usr/lib/systemd/system/nezha-agent.service
rm -rf /lib/systemd/system/nezha-agent.service
systemctl daemon-reload
fi
fi
+184
View File
@@ -0,0 +1,184 @@
var nezha = {
plugin_name: 'nezha',
init: function () {
var _this = this;
},
send:function(info){
var tips = info['tips'];
var method = info['method'];
var args = info['data'];
var callback = info['success'];
var loadT = layer.msg(tips, { icon: 16, time: 0, shade: 0.3 });
var data = {};
data['name'] = 'nezha';
data['func'] = method;
data['version'] = $('.plugin_version').attr('version');
if (typeof(args) == 'string'){
data['args'] = JSON.stringify(toArrayObject(args));
} else {
data['args'] = JSON.stringify(args);
}
$.post('/plugins/run', data, function(res) {
layer.close(loadT);
if (!res.status){
layer.msg(res.msg,{icon:2,time:10000});
return;
}
var ret_data = $.parseJSON(res.data);
console.log("send:",ret_data);
// if (!ret_data.status){
// layer.msg(ret_data.msg,{icon:2,time:2000});
// return;
// }
// console.log("send2:",ret_data);
if(typeof(callback) == 'function'){
callback(ret_data);
}
},'json');
},
postCallback:function(info){
var tips = info['tips'];
var method = info['method'];
var args = info['data'];
var callback = info['success'];
var loadT = layer.msg(tips, { icon: 16, time: 0, shade: 0.3 });
var data = {};
data['name'] = 'nezha';
data['func'] = method;
data['version'] = $('.plugin_version').attr('version');
if (typeof(args) == 'string'){
data['args'] = JSON.stringify(toArrayObject(args));
} else {
data['args'] = JSON.stringify(args);
}
$.post('/plugins/callback', data, function(res) {
layer.close(loadT);
if (!res.status){
layer.msg(res.msg,{icon:2,time:10000});
return;
}
var ret_data = $.parseJSON(res.data);
if (!ret_data.status){
layer.msg(ret_data.msg,{icon:2,time:2000});
return;
}
if(typeof(callback) == 'function'){
callback(res);
}
},'json');
},
repeatPwd:function (a, id) {
$("#"+id).val(randomStrPwd(a))
},
save_cfg:function(version){
var username = $("input[name='username']").val();
var password = $("input[name='password']").val();
this.send({
tips:'正在设置中...',
data:{'username':username,'password':password},
method:'nezha_save_cfg',
success:function(rdata){
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
}
});
},
cfg:function(version){
this.send({
tips:'正在获取中...',
method:'nezha_cfg',
success:function(data){
var d = data.data;
var value = '<p>\
<span>用户名</span>\
<input id="nz_username" style="width: 160px;" class="bt-input-text mr5" name="username" value="'+d['username']+'" type="text">\
,<span title="随机用户名" class="glyphicon glyphicon-repeat cursor" onclick="nezha.repeatPwd(8,\'nz_username\')"></span>\
</p>';
value += '<p>\
<span>密码</span>\
<input id="nz_password" style="width: 160px;" class="bt-input-text mr5" name="password" value="'+d['password']+'" type="text">\
,<span title="随机密码" class="glyphicon glyphicon-repeat cursor" onclick="nezha.repeatPwd(16,\'nz_password\')"></span>\
</p>';
var conf = '<style>.conf_p p{margin-bottom: 2px;} .conf_p span {width: 50px;}</style><div class="conf_p" style="margin-bottom:0">\
' + value + '\
<div style="margin-top:10px; padding-right:15px" class="text-right">\
<button class="btn btn-success btn-sm mr5" onclick="nezha.cfg(\'' + version + '\')">刷新</button>\
<button class="btn btn-success btn-sm" onclick="nezha.save_cfg(\'' + version + '\')">保存</button>\
</div>\
</div>'
$(".soft-man-con").html(conf);
}
});
},
agent_save_cfg:function(version){
var host = $("input[name='host']").val();
var secret = $("input[name='secret']").val();
this.send({
tips:'正在设置中...',
data:{'host':host,'secret':secret},
method:'agent_save_cfg',
success:function(rdata){
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
}
});
},
agent_cfg:function(version){
this.send({
tips:'正在获取中...',
method:'agent_cfg',
success:function(data){
var d = data.data;
var value = '<p>\
<span>地址</span>\
<input id="nz_username" style="width: 160px;" class="bt-input-text mr5" name="host" value="'+d['host']+'" type="text">\
,<font>如1.1.1.1:5444</font>\
</p>';
value += '<p>\
<span>密钥</span>\
<input id="nz_password" style="width: 160px;" class="bt-input-text mr5" name="secret" value="'+d['secret']+'" type="text">\
,<font>密钥</font>\
</p>';
var conf = '<style>.conf_p p{margin-bottom: 2px;} .conf_p span {width: 50px;}</style><div class="conf_p" style="margin-bottom:0">\
' + value + '\
<div style="margin-top:10px; padding-right:15px" class="text-right">\
<button class="btn btn-success btn-sm mr5" onclick="nezha.agent_cfg(\'' + version + '\')">刷新</button>\
<button class="btn btn-success btn-sm" onclick="nezha.agent_save_cfg(\'' + version + '\')">保存</button>\
</div>\
</div>'
$(".soft-man-con").html(conf);
}
});
},
readme:function (){
var readme = '<ul class="help-info-text c7">';
readme += '<li>安装时不会自动启动。</li>';
readme += '<li>哪吒面板是改造版,用户名和密码登录【面板配置】,不依赖github/gitee/gitlab。</li>';
readme += '<li>Agent需要先手动填写正确信息。</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
}
+158
View File
@@ -0,0 +1,158 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
install_tmp=${rootPath}/tmp/mw_install.pl
VERSION=0.15.2
# bash install.sh install 0.15.2
# cd /www/server/mdserver-web/plugins/nezha && bash install.sh install 0.15.2
# cd /Users/midoks/Desktop/mwdev/server/mdserver-web/plugins/nezha && bash install.sh install 0.15.2
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
ARCH="amd64"
get_arch() {
TMP_ARCH=`arch`
if [ "$TMP_ARCH" == "x86_64" ];then
ARCH="amd64"
elif [ "$TMP_ARCH" == "aarch64" ];then
ARCH="arm64"
else
echo $ARCH
fi
}
load_vars() {
OS=$(uname | tr '[:upper:]' '[:lower:]')
TARGET_DIR="$serverPath/nezha/dashboard"
## China_IP
if [[ -z "${CN}" ]]; then
if [[ $(curl -m 10 -s https://ipapi.co/json | grep 'China') != "" ]]; then
CN=true
fi
fi
if [[ -z "${CN}" ]]; then
GITHUB_RAW_URL="raw.githubusercontent.com/midoks/nezha/main"
GITHUB_URL="github.com"
else
GITHUB_RAW_URL="cdn.jsdelivr.net/gh/midoks/nezha@main"
GITHUB_URL="dn-dao-github-mirror.daocloud.io"
fi
echo $GITHUB_RAW_URL
echo $GITHUB_URL
}
# download file
download_file() {
url="${1}"
destination="${2}"
printf "Fetching ${url} \n\n"
if test -x "$(command -v curl)"; then
code=$(curl --connect-timeout 15 -w '%{http_code}' -L "${url}" -o "${destination}")
elif test -x "$(command -v wget)"; then
code=$(wget -t2 -T15 -O "${destination}" --server-response "${url}" 2>&1 | awk '/^ HTTP/{print $2}' | tail -1)
else
printf "\e[1;31mNeither curl nor wget was available to perform http requests.\e[0m\n"
exit 1
fi
if [ "${code}" != 200 ]; then
printf "\e[1;31mRequest failed with code %s\e[0m\n" $code
exit 1
else
printf "\n\e[1;33mDownload succeeded\e[0m\n"
fi
}
Install_dashborad(){
echo '正在安装哪吒监控...' > $install_tmp
mkdir -p $serverPath/source
if [ ! -f $TARGET_DIR/nezha ];then
DOWNLOAD_URL="https://${GITHUB_URL}/midoks/nezha/releases/download/v${VERSION}/nezha-${OS}-${ARCH}.zip"
DOWNLOAD_FILE="$(mktemp).zip"
download_file $DOWNLOAD_URL $DOWNLOAD_FILE
if [ ! -d $TARGET_DIR ]; then
mkdir -p $TARGET_DIR
fi
unzip $DOWNLOAD_FILE -d $TARGET_DIR
rm -rf $DOWNLOAD_FILE
fi
}
Install_agent(){
echo -e "正在下载监控端" > $install_tmp
mkdir -p $serverPath/source
version=v0.15.1
AGENT_TARGET_DIR="$serverPath/nezha/agent"
DOWNLOAD_URL="https://${GITHUB_URL}/nezhahq/agent/releases/download/${version}/nezha-agent_${OS}_${ARCH}.zip"
DOWNLOAD_FILE="$(mktemp).zip"
if [ ! -f $AGENT_TARGET_DIR/nezha-agent ];then
download_file $DOWNLOAD_URL $DOWNLOAD_FILE
if [ ! -d $AGENT_TARGET_DIR ]; then
mkdir -p $AGENT_TARGET_DIR
fi
unzip $DOWNLOAD_FILE -d $AGENT_TARGET_DIR
rm -rf $DOWNLOAD_FILE
fi
}
Install_App()
{
load_vars
get_arch
Install_dashborad
Install_agent
if [ -d $serverPath/nezha ];then
echo "$VERSION" > $serverPath/nezha/version.pl
cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py init_cfg
fi
echo 'install successful' > $install_tmp
}
Uninstall_App()
{
cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py initd_uninstall
cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py initd_uninstall_agent
cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py stop
cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py stop_agent
rm -rf $serverPath/nezha
echo "install fail" > $install_tmp
}
action=$1
if [ "${1}" == 'install' ];then
Install_App
else
Uninstall_App
fi
+43 -41
View File
@@ -533,49 +533,51 @@ end
function waf()
min_route()
-- C:D("min_route")
-- white ip
if waf_ip_white() then return true end
-- C:D("waf_ip_white")
-- url white
if waf_url_white() then return true end
-- C:D("waf_url_white")
-- black ip
if waf_ip_black() then return true end
-- C:D("waf_ip_black")
-- 封禁ip返回
if waf_drop_ip() then return true end
-- C:D("waf_drop_ip")
-- ua check
if waf_user_agent() then return true end
-- C:D("waf_user_agent")
if waf_url() then return true end
-- C:D("waf_url")
-- cc setting
if waf_cc_increase() then return true end
-- C:D("waf_cc_increase")
if waf_cc() then return true end
-- C:D("waf_cc")
-- cookie检查
if waf_cookie() then return true end
-- C:D("waf_cookie")
-- args参数拦截
if waf_get_args() then return true end
-- C:D("waf_get_args")
-- 扫描软件禁止
if waf_scan_black() then return true end
-- C:D("waf_scan_black")
if waf_post() then return true end
-- C:D("waf_post")
if site_config[server_name] and site_config[server_name]['open'] then
-- white ip
if waf_ip_white() then return true end
-- C:D("waf_ip_white")
-- url white
if waf_url_white() then return true end
-- C:D("waf_url_white")
-- black ip
if waf_ip_black() then return true end
-- C:D("waf_ip_black")
-- 封禁ip返回
if waf_drop_ip() then return true end
-- C:D("waf_drop_ip")
-- ua check
if waf_user_agent() then return true end
-- C:D("waf_user_agent")
if waf_url() then return true end
-- C:D("waf_url")
-- cc setting
if waf_cc_increase() then return true end
-- C:D("waf_cc_increase")
if waf_cc() then return true end
-- C:D("waf_cc")
-- cookie检查
if waf_cookie() then return true end
-- C:D("waf_cookie")
-- args参数拦截
if waf_get_args() then return true end
-- C:D("waf_get_args")
-- 扫描软件禁止
if waf_scan_black() then return true end
-- C:D("waf_scan_black")
if waf_post() then return true end
-- C:D("waf_post")
--------------------------------------------------------
--------------------------------------------------------
if X_Forwarded() then return true end
-- C:D("X_Forwarded")
if post_X_Forwarded() then return true end
+19 -12
View File
@@ -60,19 +60,26 @@ http
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;
server_tokens off;
access_log off;
# CACEH_BEGIN
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 512 4k;
proxy_busy_buffers_size 64k;
proxy_cache_path {$SERVER_PATH}/openresty/nginx/proxy_cache_temp levels=1:2 keys_zone=mw_cache:512m inactive=5m max_size=2g use_temp_path=off;
#proxy timeout
proxy_connect_timeout 3s;
proxy_read_timeout 5s;
proxy_send_timeout 5s;
server {
listen 80;
listen [::]:80;
server_name 127.0.0.1;
allow 127.0.0.1;
location /nginx_status {
stub_status on;
access_log off;
}
}
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_path {$SERVER_PATH}/openresty/nginx/fastcgi_cache_temp levels=1:2 keys_zone=mw_cache_fcgi:100m inactive=60m max_size=5g;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
# CACEH_END
server_tokens off;
access_log /dev/null;
include {$SERVER_PATH}/web_conf/nginx/vhost/*.conf;
}
@@ -0,0 +1,10 @@
server {
listen 80;
listen [::]:80;
server_name 127.0.0.1;
allow 127.0.0.1;
location /nginx_status {
stub_status on;
access_log off;
}
}
@@ -0,0 +1,4 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
+12
View File
@@ -180,6 +180,17 @@ def confReplace():
cmd_s = 'chmod u+s ' + ng_exe_bin
os.system('echo %s|sudo -S %s' % (sudoPwd, cmd_s))
# vhost
vhost_dir = mw.getServerDir() + '/web_conf/nginx/vhost'
vhost_tpl_dir = getPluginDir() + '/conf/vhost'
# print(vhost_dir, vhost_tpl_dir)
vhost_list = ['0.websocket.conf', '0.nginx_status.conf']
for f in vhost_list:
a_conf = vhost_dir + '/' + f
a_conf_tpl = vhost_tpl_dir + '/' + f
if not os.path.exists(a_conf):
mw.writeFile(a_conf, mw.readFile(a_conf_tpl))
def initDreplace():
@@ -290,6 +301,7 @@ def restart():
def reload():
confReplace()
return restyOp('reload')
+2 -2
View File
@@ -12,6 +12,6 @@
"home":"http://openresty.org",
"date":"2017-11-24",
"pid": "1",
"versions": ["1.17.8.2","1.19.3.1","1.21.4.1"],
"updates": ["1.17.8.2","1.19.3.1","1.21.4.1"]
"versions": ["1.17.8.2","1.19.3.1","1.21.4.2"],
"updates": ["1.17.8.2","1.19.3.1","1.21.4.2"]
}
+1 -1
View File
@@ -658,7 +658,7 @@ function phpLibConfig(version){
//安装扩展
function installPHPLib(version, name, title, pathinfo) {
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
layer.confirm('您真的要卸载{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase();
var data = "name=" + name + "&version=" + version + "&type=1";
+1 -1
View File
@@ -672,7 +672,7 @@ function installPHPLib(version, name, title, pathinfo) {
//卸载扩展
function uninstallPHPLib(version, name, title, pathinfo) {
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
layer.confirm('您真的要卸载{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase();
var data = 'name=' + name + '&version=' + version;
phpPost('uninstall_lib', version, data, function(data){
+2 -2
View File
@@ -12,9 +12,9 @@ version=$1
action=$2
if [ -f /lib/systemd/system/php${version}-php-fpm.service ];then
systemctl ${action} php${version}
systemctl ${action} php${version}-php-fpm
elif [[ -f /usr/lib/systemd/system/php${version}-php-fpm.service ]]; then
systemctl ${action} php${version}
systemctl ${action} php${version}-php-fpm
else
$serverPath/php/init.d/php${version} ${action}
fi
+1
View File
@@ -7,6 +7,7 @@ Description=The PHP {$VERSION} FastCGI Process Manager
After=network.target
[Service]
Environment="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/www/server/lib/icu/lib"
PIDFile={$SERVER_PATH}/php/{$VERSION}/var/run/php-fpm.pid
ExecStart={$SERVER_PATH}/php/{$VERSION}/sbin/php-fpm --nodaemonize --fpm-config {$SERVER_PATH}/php/{$VERSION}/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
+2
View File
@@ -49,6 +49,7 @@ fi
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
#初始化
@@ -59,6 +60,7 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
echo "install PHP${type} extend start"
# cd /www/server/mdserver-web/plugins/php/versions/common && bash iconv.sh install 53
# cd /www/server/mdserver-web/plugins/php/versions/common && bash intl.sh install 73
# cd /www/server/mdserver-web/plugins/php/versions/common && bash gd.sh install 56
# cd /www/server/mdserver-web/plugins/php/versions/common && bash openssl.sh install 56
# cd /www/server/mdserver-web/plugins/php/versions/common && bash sodium.sh install 81
+1 -1
View File
@@ -665,7 +665,7 @@ function installPHPLib(version, name, title, pathinfo) {
//卸载扩展
function uninstallPHPLib(version, name, title, pathinfo) {
layer.confirm('您真的要安装{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
layer.confirm('您真的要卸载{1}吗?'.replace('{1}', name), { icon: 3, closeBtn: 2 }, function() {
name = name.toLowerCase();
var data = 'name=' + name + '&version=' + version;
phpPost('uninstall_lib', version, data, function(data){
+14 -5
View File
@@ -15,11 +15,20 @@ SOURCE_ROOT=$rootPath/source/lib
if [ ! -d ${SERVER_ROOT}/freetype ];then
cd $SOURCE_ROOT
wget -O freetype-2.12.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz -T 5
tar zxvf freetype-2.12.1.tar.gz
cd freetype-2.12.1
if [ ! -f $SOURCE_ROOT/freetype-2.12.1.tar.gz ];then
wget -O freetype-2.12.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz -T 5
fi
if [ ! -d $SOURCE_ROOT/freetype-2.12.1 ];then
tar zxvf freetype-2.12.1.tar.gz
cd freetype-2.12.1
else
cd freetype-2.12.1
fi
./configure --prefix=${SERVER_ROOT}/freetype && make && make install
cd $SOURCE_ROOT
cd $SOURCE_ROOT && rm -rf freetype-2.12.1
#rm -rf freetype-2.12.1.tar.gz
#rm -rf freetype-2.12.1
fi
+14 -5
View File
@@ -15,11 +15,20 @@ SOURCE_ROOT=$rootPath/source/lib
if [ ! -d ${SERVER_ROOT}/freetype_old ];then
cd $SOURCE_ROOT
wget -O freetype-2.7.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz -T 5
tar zxvf freetype-2.7.1.tar.gz
cd freetype-2.7.1
if [ ! -f $SOURCE_ROOT/freetype-2.7.1.tar.gz ];then
wget -O freetype-2.7.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz -T 5
fi
if [ ! -d $SOURCE_ROOT/freetype-2.7.1 ];then
tar zxvf freetype-2.7.1.tar.gz
cd freetype-2.7.1
else
cd freetype-2.7.1
fi
./configure --prefix=${SERVER_ROOT}/freetype_old && make && make install
#cd $SOURCE_ROOT
cd $SOURCE_ROOT && rm -rf freetype-2.7.1
#rm -rf freetype-2.7.1.tar.gz
#rm -rf freetype-2.7.1
fi
+16
View File
@@ -24,6 +24,22 @@ mkdir -p $serverPath/php
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.gz https://museum.php.net/php5/php-${version}.tar.gz
fi
+16
View File
@@ -24,6 +24,22 @@ mkdir -p $serverPath/php
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz
fi
+16
View File
@@ -24,6 +24,22 @@ mkdir -p $serverPath/php
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.gz https://museum.php.net/php5/php-${version}.tar.gz
fi
+16
View File
@@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz
fi
+16
View File
@@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz
fi
+16
View File
@@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
+16
View File
@@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
+16
View File
@@ -24,6 +24,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
+15
View File
@@ -28,6 +28,21 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
+15
View File
@@ -36,6 +36,21 @@ fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
+17 -1
View File
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
version=8.0.27
version=8.0.29
PHP_VER=80
Install_php()
{
@@ -35,6 +35,22 @@ if [ "$?" == "0" ];then
fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
+17 -1
View File
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
version=8.1.15
version=8.1.20
PHP_VER=81
Install_php()
{
@@ -36,6 +36,22 @@ fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
fi
+17 -1
View File
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
version=8.2.2
version=8.2.7
PHP_VER=82
Install_php()
{
@@ -36,6 +36,22 @@ fi
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
# ----------------------------------------------------------------------- #
# 中国优化安装
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
LOCAL_ADDR=common
if [ ! -z "$cn" ];then
LOCAL_ADDR=cn
fi
if [ "$LOCAL_ADDR" == "cn" ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz
fi
fi
# ----------------------------------------------------------------------- #
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
fi
+2 -1
View File
@@ -38,9 +38,10 @@ done
cd $DIR
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
# yar
PHP_EXT_LIST=(ioncube ZendGuardLoader pdo mysqlnd sqlite3 openssl pcntl opcache mcrypt fileinfo \
exif gd intl memcache memcached redis imagemagick xdebug xhprof \
swoole yaf yar yac apc mongo mongodb solr seaslog mbstring iconv phalcon)
swoole yaf yac apc mongo mongodb solr seaslog mbstring iconv phalcon)
for PHP_VER in ${PHP_VER_LIST[@]}; do
echo "php${PHP_VER} -- start"
+31 -1
View File
@@ -11,9 +11,37 @@ rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
# _os=`uname`
# if [ ${_os} == "Darwin" ]; then
# OSNAME='macos'
# elif grep -Eq "openSUSE" /etc/*-release; then
# OSNAME='opensuse'
# elif grep -Eq "FreeBSD" /etc/*-release; then
# OSNAME='freebsd'
# elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
# OSNAME='rhel'
# elif grep -Eqi "Fedora" /etc/issue || grep -Eqi "Fedora" /etc/*-release; then
# OSNAME='rhel'
# elif grep -Eqi "Rocky" /etc/issue || grep -Eqi "Rocky" /etc/*-release; then
# OSNAME='rhel'
# elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eqi "AlmaLinux" /etc/*-release; then
# OSNAME='rhel'
# elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eqi "Amazon Linux" /etc/*-release; then
# OSNAME='amazon'
# elif grep -Eqi "Debian" /etc/issue || grep -Eqi "Debian" /etc/*-release; then
# OSNAME='debian'
# elif grep -Eqi "Ubuntu" /etc/issue || grep -Eqi "Ubuntu" /etc/*-release; then
# OSNAME='ubuntu'
# else
# OSNAME='unknow'
# fi
actionType=$1
version=$2
LIBNAME=intl
LIBV=0
@@ -33,7 +61,9 @@ else
fi
OPTIONS=''
if [ "$version" -lt "71" ];then
if [ "$version" -lt "74" ];then
# cd /www/server/mdserver-web/plugins/php/lib && /bin/bash icu.sh
cd ${rootPath}/plugins/php/lib && /bin/bash icu.sh
OPTIONS="--with-icu-dir=${serverPath}/lib/icu"
fi
+1 -1
View File
@@ -23,7 +23,7 @@ if [ "$version" -lt "73" ];then
fi
if [ "$version" -gt "74" ];then
LIBV=5.1.2
LIBV=5.2.1
fi
LIB_PATH_NAME=lib/php
+5
View File
@@ -32,6 +32,11 @@ if [ "$version" -eq "72" ] || [ "$version" -eq "73" ];then
fi
if [ "$version" -gt "74" ];then
LIBV=3.3.5
fi
LIB_PATH_NAME=lib/php
if [ -d $serverPath/php/${version}/lib64 ];then
LIB_PATH_NAME=lib64
+8 -7
View File
@@ -51,10 +51,11 @@ Install_pureftp()
# https://github.com/jedisct1/pure-ftpd/releases/download/1.0.49/pure-ftpd-1.0.49.tar.gz
# https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
# DOWNLOAD=https://github.com/jedisct1/pure-ftpd/releases/download/${VER}/pure-ftpd-${VER}.tar.gz
VER=$1
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
DOWNLOAD=https://github.com/jedisct1/pure-ftpd/releases/download/${VER}/pure-ftpd-${VER}.tar.gz
# DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
# curl -sSLo pure-ftpd-1.0.49.tar.gz https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
if [ ! -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
@@ -68,14 +69,14 @@ Install_pureftp()
md5_check=`md5sum $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz | awk '{print $1}'`
if [ "${md5_ok}" == "${md5_check}" ]; then
echo "pure-ftpd file check ok"
else
# 重新下载
rm -rf $serverPath/source/pureftp/pure-ftpd-${VER}
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
# curl -sSLo $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
fi
fi
# Last Download Method
if [ ! -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz https://dl.midoks.me/soft/ftp/pure-ftpd-${VER}.tar.gz -T 3
fi
if [ ! -d $serverPath/source/pureftp/pure-ftpd-${VER} ];then
cd $serverPath/source/pureftp && tar zxvf pure-ftpd-${VER}.tar.gz
fi
+11 -11
View File
@@ -782,20 +782,20 @@ def lsyncdAdd():
info['rsync'] = rsync
if not 'exclude' in info:
info["exclude"] = [
"/**.upload.tmp",
"**/*.log",
"**/*.tmp",
"**/*.temp",
".git",
".gitignore",
".user.ini",
]
data = getDefaultConf()
slist = data['send']["list"]
res = lsyncdListFindName(slist, info['name'])
if not 'exclude' in info:
if res[0]:
info["exclude"] = slist[res[1]]['exclude']
else:
info["exclude"] = [
"/**.upload.tmp", "**/*.log", "**/*.tmp",
"**/*.temp", ".git", ".gitignore", ".user.ini",
]
if res[0]:
list_index = res[1]
slist[list_index] = info
+4 -4
View File
@@ -476,7 +476,7 @@ function lsyncdExclude(name){
}
function lsyncdConfLog(){
pluginStandAloneLogs("rsyncd","","lsyncd_conf_log");;
pluginRollingLogs("rsyncd","","lsyncd_conf_log");;
}
function lsyncdSend(){
@@ -492,7 +492,7 @@ function lsyncdSend(){
con += '<div style="padding-top:1px;">\
<button class="btn btn-success btn-sm" onclick="createSendTask();">创建发送任务</button>\
<button class="btn btn-success btn-sm" onclick="lsyncdConfLog();">日志</button>\
<button class="btn btn-success btn-sm" onclick="lsyncdConfLog();">自动同步日志</button>\
</div>';
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
@@ -532,7 +532,7 @@ function lsyncdSend(){
'<td>' + period +'</td>' +
'<td>\
<a class="btlink" onclick="lsyncdRun(\''+list[i]['name']+'\')">同步</a>\
| <a class="btlink" onclick="lsyncdLog(\''+list[i]['name']+'\')">日志</a>\
| <a class="btlink" onclick="lsyncdLog(\''+list[i]['name']+'\')">手动日志</a>\
| <a class="btlink" onclick="lsyncdExclude(\''+list[i]['name']+'\')">过滤器</a>\
| <a class="btlink" onclick="createSendTask(\''+list[i]['name']+'\')">编辑</a>\
| <a class="btlink" onclick="lsyncdDelete(\''+list[i]['name']+'\')">删除</a>\
@@ -562,7 +562,7 @@ function rsyncdConf(){
}
function rsyncdLog(){
pluginStandAloneLogs("rsyncd","","run_log");
pluginRollingLogs("rsyncd","","run_log");
}
+3 -1
View File
@@ -923,10 +923,12 @@
"python",
"python3",
"ifdown",
"node"
"node",
"sd-pam"
],
"process_exclude": [
"php-fpm",
"git",
"mysqld",
"mongod",
"dockerd",
+6
View File
@@ -171,6 +171,12 @@ def reload():
content = mw.readFile(tgbot_tpl)
mw.writeFile(tgbot_dst, content)
tgpush_tpl = getPluginDir() + '/startup/tgpush.py'
tgpush_dst = getServerDir() + '/tgpush.py'
content = mw.readFile(tgpush_tpl)
mw.writeFile(tgpush_dst, content)
ext_src = getPluginDir() + '/startup/extend'
ext_dst = getServerDir()
+10
View File
@@ -33,6 +33,7 @@ tg_start(){
echo -e "starting tgbot... \c"
cd $mw_path
python3 {$APP_PATH}/tgbot.py >> {$APP_PATH}/task.log &
python3 {$APP_PATH}/tgpush.py >> {$APP_PATH}/push.log &
isStart=""
while [[ "$isStart" == "" ]];
do
@@ -64,6 +65,15 @@ tg_stop(){
kill -9 $p > /dev/null 2>&1
done
echo -e "\033[32mdone\033[0m"
echo -e "stopping tgpush ... \c";
arr=`ps aux|grep 'tgpush.py'|grep -v grep|awk '{print $2}'`
for p in ${arr[@]}
do
kill -9 $p > /dev/null 2>&1
done
echo -e "\033[32mdone\033[0m"
}
case "$1" in
+1 -1
View File
@@ -22,6 +22,6 @@ def init(bot):
bot.set_my_commands(
commands=[
telebot.types.BotCommand("start", "查看帮助信息"),
telebot.types.BotCommand("faq", "查看bbs帖子主题【不要忘记:冒号】"),
telebot.types.BotCommand("faq", "查看bbs帖子主题【?:】"),
],
)
+14 -9
View File
@@ -41,30 +41,35 @@ def send_msg(bot, tag='ad', trigger_time=300):
mw.writeFile(lock_file, json.dumps(lock_data))
# 信号只在一个周期内执行一次|end
# https://t.me/gjgzs2022 | 19/m
# ♻️CMS导航网♻️/💰流量变现💰 | 28/m
# CK资源采集 |29/m
# https://zhaoziyuan.la/ | 15/m | 2m | next,5/15
# https://t.me/gjgzs2022 | 22/m
# 高价收量 👑 集团收量 ❤️ 流量变现/支付宝代付 ❤️ 微信代付/实名认证/过人脸🕵️‍♀️各种账号处理✅ | 28/m
# https://zhaoziyuan.la/ | web | 15/m | 2m | next,7/15
# 香港高防CDN |9/m
# mvirtua | web | 7/m
keyboard = [
[
types.InlineKeyboardButton(
text="CK资源采集", url='https://ckzy1.com/')
text="实卡接码🙎‍♂️代实名/过人脸🅾️开飞机会员", url='https://t.me/gjgzs2022')
],
[
types.InlineKeyboardButton(
text="♻️CMS导航网♻️", url='https://t.me/maccms_jccms')
text="香港高防CDN、免实名、试用30天", url='https://www.100dun.com')
],
[
types.InlineKeyboardButton(
text="💰流量变现💰", url='https://t.me/taohaozhan')
text="实名认证/过人脸🕵️‍♀️各种账号处理✅", url='https://t.me/zhanzhangyewu')
],
[
types.InlineKeyboardButton(
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
text="支付宝代付 ❤️ 微信代付", url='https://t.me/Uxuanzhenpin')
],
[
types.InlineKeyboardButton(
text="倩倩CDN服务器", url='https://t.me/KLT_12'),
text="高价收量 👑 集团收量 ❤️ 流量变现", url='https://t.me/maccms_jccms/93')
],
[
types.InlineKeyboardButton(
text="官网", url='https://github.com/midoks/mdserver-web'),
types.InlineKeyboardButton(
text="💎DigitalVirt(赞助商)", url='https://digitalvirt.com/aff.php?aff=154')
],
+17 -1
View File
@@ -22,6 +22,16 @@ chat_id = -1001578009023
# chat_id = 5568699210
def writeLog(log_str):
if __name__ == "__main__":
print(log_str)
now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgbot/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True
def get_newest_tid():
api_new = 'https://bbs.midoks.me/plugin.php?id=external_api&f=bbs_newest'
@@ -86,7 +96,13 @@ def send_msg(bot, tag='ad', trigger_time=300):
def run(bot):
send_msg(bot, 'push_bbs_newest_tid', 300)
try:
send_msg(bot, 'push_bbs_newest_tid', 300)
except Exception as e:
writeLog('-----push_bbs_newest_tid error start -------')
print(mw.getTracebackInfo())
writeLog('-----push_bbs_newest_tid error start -------')
if __name__ == "__main__":
@@ -22,6 +22,16 @@ chat_id = -1001578009023
# chat_id = 5568699210
def writeLog(log_str):
if __name__ == "__main__":
print(log_str)
now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgbot/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True
def send_msg(bot, tag='ad', trigger_time=300):
# 信号只在一个周期内执行一次|start
lock_file = mw.getServerDir() + '/tgbot/lock.json'
@@ -40,29 +50,35 @@ def send_msg(bot, tag='ad', trigger_time=300):
mw.writeFile(lock_file, json.dumps(lock_data))
# 信号只在一个周期内执行一次|end
# https://t.me/gjgzs2022 | 19/m
# ♻️CMS导航网♻️/💰流量变现💰 | 28/m
# CK资源采集 |29/m
# https://t.me/gjgzs2022 | 22/m
# 高价收量 👑 集团收量 ❤️ 流量变现/支付宝代付 ❤️ 微信代付/实名认证/过人脸🕵️‍♀️各种账号处理✅ | 28/m
# https://zhaoziyuan.la/ | web | 15/m | 2m | next,9/15
# 香港高防CDN |9/m
# mvirtua | web | 7/m
keyboard = [
[
types.InlineKeyboardButton(
text="CK资源采集", url='https://ckzy1.com/')
text="实卡接码🙎‍♂️代实名/过人脸🅾️开飞机会员", url='https://t.me/gjgzs2022')
],
[
types.InlineKeyboardButton(
text="♻️CMS导航网♻️", url='https://t.me/maccms_jccms')
text="香港高防CDN、免实名、试用30天", url='https://www.100dun.com')
],
[
types.InlineKeyboardButton(
text="💰流量变现💰", url='https://t.me/taohaozhan')
text="实名认证/过人脸🕵️‍♀️各种账号处理✅", url='https://t.me/zhanzhangyewu')
],
[
types.InlineKeyboardButton(
text="🙎‍♂️代实名🙍‍♀️过人脸🅾️国际阿里云腾讯云(赞助商)", url='https://t.me/gjgzs2022')
text="支付宝代付 ❤️ 微信代付", url='https://t.me/Uxuanzhenpin')
],
[
types.InlineKeyboardButton(
text="倩倩CDN服务器", url='https://t.me/KLT_12'),
text="高价收量 👑 集团收量 ❤️ 流量变现", url='https://t.me/maccms_jccms/93')
],
[
types.InlineKeyboardButton(
text="官网", url='https://github.com/midoks/mdserver-web'),
types.InlineKeyboardButton(
text="💎DigitalVirt(赞助商)", url='https://digitalvirt.com/aff.php?aff=154')
],
@@ -94,7 +110,7 @@ def send_msg(bot, tag='ad', trigger_time=300):
def run(bot):
try:
send_msg(bot, 'notice_msg', 180)
send_msg(bot, 'notice_msg', 90)
except Exception as e:
writeLog('-----push_notice_msg error start -------')
print(mw.getTracebackInfo())
+13 -17
View File
@@ -189,26 +189,22 @@ def run(bot, message):
return bot
# print(text_body)
if isThisCmd('/faq:', text_body):
cmd_text = getReadCmd('/faq:', text_body)
if isThisCmd('/?:', text_body):
cmd_text = getReadCmd('/?:', text_body)
return searchFaq(bot, message, cmd_text)
# if isThisCmd('/debug', text_body):
# cmd_text = getReadCmd('/debug', text_body)
# return searchDebug(bot, message, cmd_text)
# if text_body.find('?') > -1 or text_body.find('?') > -1:
# return_msg = "你似乎在寻找【" + text_body + "】答案:\n"
# return_msg += "/faq:开始寻找你的问题\n"
# keyboard = [
# [
# types.InlineKeyboardButton(
# text="如未找到,可以在论坛补充你的提问!", url='https://bbs.midoks.me'),
# ]
if text_body.find('?') > -1 or text_body.find('?') > -1:
return_msg = "你似乎在寻找【" + text_body + "】答案:\n"
return_msg += "/faq:开始寻找你的问题\n"
keyboard = [
[
types.InlineKeyboardButton(
text="如未找到,可以在论坛补充你的提问!", url='https://bbs.midoks.me'),
]
]
markup = types.InlineKeyboardMarkup(keyboard)
bot.reply_to(message, return_msg, reply_markup=markup)
# ]
# markup = types.InlineKeyboardMarkup(keyboard)
# bot.reply_to(message, return_msg, reply_markup=markup)
return bot
-53
View File
@@ -95,15 +95,6 @@ for p in init_list:
writeLog(mw.getTracebackInfo())
writeLog('-----init error end -------')
# @bot.message_handler(commands=['start', 'help'])
# def hanle_start_help(message):
# bot.reply_to(message, "hello world")
# @bot.message_handler(commands=['mw_echo'])
# def hanle_mw_echo(message):
# bot.reply_to(message, message.text)
@bot.message_handler(commands=['chat_id'])
def hanle_get_chat_id(message):
@@ -136,42 +127,6 @@ def callback_query_handler(call):
writeLog('-----callback_query_handler error end -------')
def runBotPushTask():
plist = getStartExtCfgByTag('push')
for p in plist:
try:
script = p['name'].split('.')[0]
__import__(script).run(bot)
except Exception as e:
writeLog('-----runBotPushTask error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----runBotPushTask error end -------')
def botPush():
while True:
runBotPushTask()
time.sleep(1)
def runBotPushOtherTask():
plist = getStartExtCfgByTag('other')
for p in plist:
try:
script = p['name'].split('.')[0]
__import__(script).run(bot)
except Exception as e:
writeLog('-----runBotPushOtherTask error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----runBotPushOtherTask error end -------')
def botPushOther():
while True:
runBotPushOtherTask()
time.sleep(1)
def runBot(bot):
try:
bot.polling()
@@ -184,14 +139,6 @@ def runBot(bot):
if __name__ == "__main__":
# 机器人推送任务
botPushTask = threading.Thread(target=botPush)
botPushTask.start()
# 机器人其他推送任务
botPushOtherTask = threading.Thread(target=botPushOther)
botPushOtherTask.start()
writeLog('启动成功')
runBot(bot)
+132
View File
@@ -0,0 +1,132 @@
# coding:utf-8
import sys
import io
import os
import time
import re
import json
import base64
import threading
sys.path.append(os.getcwd() + "/class/core")
import mw
import telebot
def getPluginName():
return 'tgbot'
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
def getServerDir():
return mw.getServerDir() + '/' + getPluginName()
sys.path.append(getServerDir() + "/extend")
def getConfigData():
cfg_path = getServerDir() + "/data.cfg"
if not os.path.exists(cfg_path):
mw.writeFile(cfg_path, '{}')
t = mw.readFile(cfg_path)
return json.loads(t)
def writeConf(data):
cfg_path = getServerDir() + "/data.cfg"
mw.writeFile(cfg_path, json.dumps(data))
return True
def getExtCfg():
cfg_path = getServerDir() + "/extend.cfg"
if not os.path.exists(cfg_path):
mw.writeFile(cfg_path, '{}')
t = mw.readFile(cfg_path)
return json.loads(t)
def getStartExtCfgByTag(tag='push'):
# 获取开启的扩展
elist = getExtCfg()
rlist = []
for x in elist:
if x['tag'] == tag and x['status'] == 'start':
rlist.append(x)
return rlist
def writeLog(log_str):
if __name__ == "__main__":
print(log_str)
now = mw.getDateFromNow()
log_file = getServerDir() + '/push.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True
# start tgbot
cfg = getConfigData()
while True:
cfg = getConfigData()
if 'bot' in cfg and 'app_token' in cfg['bot']:
if cfg['bot']['app_token'] != '' and cfg['bot']['app_token'] != 'app_token':
break
writeLog('等待输入配置,填写app_token')
time.sleep(3)
bot = telebot.TeleBot(cfg['bot']['app_token'])
def runBotPushTask():
plist = getStartExtCfgByTag('push')
for p in plist:
try:
script = p['name'].split('.')[0]
__import__(script).run(bot)
except Exception as e:
writeLog('-----runBotPushTask error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----runBotPushTask error end -------')
def botPush():
while True:
runBotPushTask()
time.sleep(1)
def runBotPushOtherTask():
plist = getStartExtCfgByTag('other')
for p in plist:
try:
script = p['name'].split('.')[0]
__import__(script).run(bot)
except Exception as e:
writeLog('-----runBotPushOtherTask error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----runBotPushOtherTask error end -------')
def botPushOther():
while True:
runBotPushOtherTask()
time.sleep(1)
if __name__ == "__main__":
# 机器人推送任务
botPushTask = threading.Thread(target=botPush)
botPushTask.start()
# 机器人其他推送任务
botPushOtherTask = threading.Thread(target=botPushOther)
botPushOtherTask.start()
+1
View File
@@ -2,6 +2,7 @@ function readme(){
var readme = '<ul class="help-info-text c7">';
readme += '<li>在填写好配置信息好后,还要执行下面命令。进行手机号和短信码验证。再重启,即可正常使用</li>';
readme += '<li>cd /www/server/mdserver-web && source bin/activate && python3 /www/server/tgclient/tgclient.py</li>';
readme += '<li>https://my.telegram.org/auth</li>';
readme += '</ul>';
$('.soft-man-con').html(readme);
}
+10 -3
View File
@@ -24,8 +24,9 @@ chat_id_list = [-1001578009023]
filter_g_id = [-1001771526434]
msg_ad = "本人软件推广(30s)\n\n"
msg_ad += "开源地址(Linux面板) mdserver-web,站长必备,不收费,无毒。源码为证。全靠TG乞讨! \n"
msg_ad = "本人软件推广(10s)\n\n"
msg_ad += "开源Linux面板【mdserver-web】,站长必备,无毒,源码为证。\n"
msg_ad += "不收费,全靠TG乞讨! \n"
msg_ad += "看个人简介,加入群聊,一起进步!\n"
# msg_ad += "https://github.com/midoks/mdserver-web \n"
# msg_ad += "\n"
@@ -65,7 +66,7 @@ async def send_msg(client, chat_id, tag='ad', trigger_time=600):
# 信号只在一个周期内执行一次|end
msg = await client.send_message(chat_id, msg_ad)
await asyncio.sleep(30)
await asyncio.sleep(10)
await client.delete_messages(chat_id, msg)
await asyncio.sleep(3)
@@ -78,13 +79,19 @@ async def run(client):
info = await client.get_dialogs()
for chat in info:
if chat.is_group and not chat.id in filter_g_id:
chat_id = str(chat.id)
if chat_id[0:4] != '-100':
continue
# print(chat)
await writeLog('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
try:
await send_msg(client, chat.id, 'ad_' + str(chat.id))
except Exception as e:
await writeLog(str(chat))
await writeLog(str(e))
if __name__ == "__main__":
pass
@@ -21,22 +21,47 @@ from telebot.util import quick_markup
# 指定群ID
chat_id_list = [-1001578009023, -1001979545570]
chat_id_list = [-1001979545570]
# 别人群ID[有API调用限制]
chat_id_list_other = [-1001578009023, -1001771526434]
async def writeLog(log_str):
if __name__ == "__main__":
print(log_str)
now = mw.getDateFromNow()
log_file = mw.getServerDir() + '/tgclient/task.log'
mw.writeFileLog(now + ':' + log_str, log_file, limit_size=5 * 1024)
return True
async def run(client):
for chat_id in chat_id_list:
s = await client.send_message(chat_id, '开始自动检测已经注销群成员...')
count = 0
async for user in client.iter_participants(chat_id):
if user.deleted:
count += 1
msg = await client.kick_participant(chat_id, user)
try:
s = await client.send_message(chat_id, '开始自动检测已经注销群成员...')
count = 0
async for user in client.iter_participants(chat_id):
if user.deleted:
count += 1
msg = await client.kick_participant(chat_id, user)
await client.edit_message(chat_id, s.id, '已经检测到有(%d)个账户已失效' % (count))
await asyncio.sleep(3)
await client.edit_message(chat_id, s.id, '自动检测已经注销群成员完毕!!!')
await asyncio.sleep(3)
await client.delete_messages(chat_id, s)
except Exception as e:
print(str(e))
writeLog(str(e))
for chat_id in chat_id_list_other:
try:
async for user in client.iter_participants(chat_id):
if user.deleted:
msg = await client.kick_participant(chat_id, user)
except Exception as e:
print(str(e))
writeLog(str(e))
await client.edit_message(chat_id, s.id, '已经检测到有(%d)个账户已失效' % (count))
await asyncio.sleep(3)
await client.edit_message(chat_id, s.id, '自动检测已经注销群成员完毕!!!')
await asyncio.sleep(3)
await client.delete_messages(chat_id, s)
await asyncio.sleep(300)
@@ -0,0 +1,54 @@
# coding:utf-8
# func: 临时测试
import sys
import io
import os
import time
import re
import json
import base64
import threading
import asyncio
sys.path.append(os.getcwd() + "/class/core")
import mw
from telethon import utils
from telethon import functions, types
from telethon.tl.functions.messages import AddChatUserRequest
from telethon.tl.functions.channels import InviteToChannelRequest
# 指定群ID
chat_id = -1001979545570
filter_user_id = 5568699210
filter_g_id = [-1001771526434]
async def run(client):
my_channel = await client.get_entity(PeerChannel(-1001173826177))
print(my_channel)
for i in range(9999999999):
try:
v = -1001000000000 - i
my_channel = await client.get_entity(PeerChannel(v))
print(my_channel)
except Exception as e:
pass
# -1001809140739
# -1001800000000
# -1000000000001
info = await client.get_dialogs()
for chat in info:
if not chat.is_group and chat.is_channel:
print('name:{0} id:{1} is_user:{2} is_channel:{3} is_group:{4}'.format(
chat.name, chat.id, chat.is_user, chat.is_channel, chat.is_group))
await asyncio.sleep(10)
if __name__ == "__main__":
pass
+7 -7
View File
@@ -1,22 +1,22 @@
setuptools>=33.1.1
Werkzeug>=1.0.1
wheel==0.37.1
wheel>=0.37.1
gunicorn==20.1.0
requests==2.27.1
requests>=2.27.1
urllib3>=1.21.1
flask==2.0.3
flask>=2.0.3
flask-session==0.3.2
flask-helper==0.19
flask-bcrypt==1.0.1
flask-caching>=1.10.1
cache==1.0.3
gevent==21.12.0
gevent==22.10.2
gevent-websocket==0.10.1
psutil==5.9.1
chardet==3.0.4
flask-sqlalchemy==2.3.2
pyOpenSSL==22.0.0
cryptography==36.0.1
pyOpenSSL==23.2.0
cryptography>=40.0.2
configparser==5.2.0
python-engineio==4.3.2
python-socketio>=4.2.0
@@ -30,4 +30,4 @@ Jinja2>=2.11.2
PyMySQL==1.0.2
whitenoise==5.3.0
pyTelegramBotAPI
telebot
telebot
+15
View File
@@ -0,0 +1,15 @@
#PROXY-START/
# root /www/server/nezha/dashboard/resource;
location / {
proxy_pass http://127.0.0.1:9527;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$ {
proxy_pass http://127.0.0.1:9527;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
#PROXY-END/
+8 -2
View File
@@ -47,7 +47,7 @@ cache.init_app(app, config={'CACHE_TYPE': 'simple'})
try:
from flask_sqlalchemy import SQLAlchemy
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/mw_session.db'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/py_mw_session.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.config['SESSION_TYPE'] = 'sqlalchemy'
app.config['SESSION_SQLALCHEMY'] = sdb
@@ -60,7 +60,6 @@ except:
str(sys.version_info[0])
app.config['SESSION_FILE_THRESHOLD'] = 1024
app.config['SESSION_FILE_MODE'] = 384
mw.execShell("pip install flask_sqlalchemy &")
app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
app.config['SESSION_PERMANENT'] = True
@@ -178,6 +177,13 @@ def requestCheck():
return domain_check
@app.after_request
def requestAfter(response):
response.headers['soft'] = 'mdserver-web'
response.headers['mw-version'] = app.config.version
return response
def isLogined():
if 'login' in session and 'username' in session and session['login'] == True:
userInfo = mw.M('users').where(
+128 -221
View File
@@ -1,78 +1,100 @@
//默认显示7天周期图表
setTimeout(function(){
Wday(0,'getload');
},500);
},100);
setTimeout(function(){
Wday(0,'cpu');
},500);
},200);
setTimeout(function(){
Wday(0,'mem');
},1000);
},500);
setTimeout(function(){
Wday(0,'disk');
},1500);
},100);
setTimeout(function(){
Wday(0,'network');
},2000);
},1500);
$(".st").hover(function(){
$(".searcTime .st").click(function(){
var status = $(this).data('status');
if (status == 'show'){
$(this).next().hide();
$(this).data('status','hide');
} else{
$(this).next().show();
$(this).data('status','show');
}
});
//自定义时间-切换
$(".searcTime .st").hover(function(){
$(this).data('status','show');
$(this).next().show();
},function(){
$(this).next().hide();
$(this).next().hover(function(){
$(this).show();
},function(){
$(this).hide();
})
// $(this).next().hide();
// $(this).next().hover(function(){
// $(this).show();
// },function(){
// $(this).hide();
// })
})
$(".searcTime .gt").click(function(){
$(this).addClass("on").siblings().removeClass("on");
})
$(".loadbtn").click(function(){
$(this).parents(".searcTime").find("span").removeClass("on");
$(this).parents(".searcTime").find(".st").addClass("on");
var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000;
var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000;
//渲染日期时间范围 start
var render_dlist = [
'loadbtn_rtime',
'cpubtn_rtime',
'membtn_rtime',
'diskbtn_rtime',
'networkbtn_rtime'
];
for (var i = 0; i < render_dlist.length; i++) {
laydate.render({
elem: '#'+render_dlist[i]
,type: 'datetime'
,range: true
});
var b = getBeforeDate(28).replaceAll('/','-') + " 00:00:00";
var e = getBeforeDate(0).replaceAll('/','-') + " 23:59:59";
$('#'+render_dlist[i]).val(b + ' - ' + e);
}
//渲染日期时间范围 end
$('.sbtn').click(function(){
$(".searcTime .st").next().hide();
var rtime = $(this).parent().find(".rtime").val();
var rarr = rtime.split(' - ');
var b = (new Date(rarr[0]).getTime())/1000;
var e = (new Date(rarr[1]).getTime())/1000;
b = Math.round(b);
e = Math.round(e);
getload(b,e)
})
$(".cpubtn").click(function(){
$(this).parents(".searcTime").find("span").removeClass("on");
$(this).parents(".searcTime").find(".st").addClass("on");
var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000;
var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000;
b = Math.round(b);
e = Math.round(e);
cpu(b,e)
})
$(".membtn").click(function(){
$(this).parents(".searcTime").find("span").removeClass("on");
$(this).parents(".searcTime").find(".st").addClass("on");
var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000;
var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000;
b = Math.round(b);
e = Math.round(e);
mem(b,e)
})
$(".diskbtn").click(function(){
$(this).parents(".searcTime").find("span").removeClass("on");
$(this).parents(".searcTime").find(".st").addClass("on");
var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000;
var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000;
b = Math.round(b);
e = Math.round(e);
disk(b,e)
})
$(".networkbtn").click(function(){
$(this).parents(".searcTime").find("span").removeClass("on");
$(this).parents(".searcTime").find(".st").addClass("on");
var b = (new Date($(this).parent().find(".btime").val()).getTime())/1000;
var e = (new Date($(this).parent().find(".etime").val()).getTime())/1000;
b = Math.round(b);
e = Math.round(e);
network(b,e)
})
if ($(this).hasClass('loadbtn')){
getload(b,e);
} else if ($(this).hasClass('cpubtn')){
cpu(b,e);
}else if ($(this).hasClass('membtn')){
mem(b,e);
} else if ($(this).hasClass('diskbtn')){
disk(b,e);
}
});
//指定天数
function Wday(day,name){
var now = (new Date().getTime())/1000;
@@ -94,19 +116,19 @@ function Wday(day,name){
}
switch (name){
case "cpu":
cpu(b,e);
cpu(b, e);
break;
case "mem":
mem(b,e);
mem(b, e);
break;
case "disk":
disk(b,e);
disk(b, e);
break;
case "network":
network(b,e);
network(b, e);
break;
case "getload":
getload(b,e);
getload(b, e);
break;
}
}
@@ -119,6 +141,7 @@ function getToday(){
return str;
}
getStatus();
//取监控状态
function getStatus(){
loadT = layer.msg('正在读取,请稍候...',{icon:16,time:0})
@@ -141,7 +164,7 @@ function getStatus(){
},'json');
}
getStatus();
//设置监控状态
function setControl(act, value=false){
@@ -172,8 +195,9 @@ function setControl(act, value=false){
loadT = layer.msg('正在处理,请稍候...',{icon:16,time:0})
$.post('/system/set_control','type='+type+'&day='+day,function(rdata){
layer.close(loadT);
layer.msg(rdata.msg,{icon:rdata.status?1:2});
showMsg(rdata.msg, function(){
layer.close(loadT);
},{icon:rdata.status?1:2})
},'json');
}
@@ -183,8 +207,9 @@ function closeControl(){
layer.confirm('您真的清空所有监控记录吗?',{title:'清空记录',icon:3,closeBtn:1}, function() {
loadT = layer.msg('正在处理,请稍候...',{icon:16,time:0})
$.post('/system/set_control','type=del',function(rdata){
layer.close(loadT);
layer.msg(rdata.msg,{icon:rdata.status?1:2});
showMsg(rdata.msg, function(){
layer.close(loadT);
},{icon:rdata.status?1:2})
},'json');
});
}
@@ -199,19 +224,18 @@ function getBeforeDate(n){
var day=d.getDate();
if(day <= n){
if(mon>1) {
mon=mon-1;
}
else {
year = year-1;
mon = 12;
mon = mon-1;
} else {
year = year-1;
mon = 12;
}
}
d.setDate(d.getDate()-n);
year = d.getFullYear();
mon=d.getMonth()+1;
day=d.getDate();
s = year+"/"+(mon<10?('0'+mon):mon)+"/"+(day<10?('0'+day):day);
return s;
s = year+"/"+(mon<10?('0'+mon):mon)+"/"+(day<10?('0'+day):day);
return s;
}
//cpu
function cpu(b,e){
@@ -229,20 +253,14 @@ function cpu(b,e){
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
axisPointer: { type: 'cross' },
formatter: '{b}<br />{a}: {c}%'
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData,
axisLine:{
lineStyle:{
color:"#666"
}
}
axisLine:{ lineStyle:{ color:"#666"} }
},
yAxis: {
type: 'value',
@@ -250,16 +268,8 @@ function cpu(b,e){
boundaryGap: [0, '100%'],
min:0,
max: 100,
splitLine:{
lineStyle:{
color:"#ddd"
}
},
axisLine:{
lineStyle:{
color:"#666"
}
}
splitLine:{ lineStyle:{ color:"#ddd" } },
axisLine:{ lineStyle:{ color:"#666" } }
},
dataZoom: [{
type: 'inside',
@@ -286,17 +296,13 @@ function cpu(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgb(0, 153, 238)'
}
},
itemStyle: { normal: { color: 'rgb(0, 153, 238)' } },
data: yData
}
]
};
myChartCpu.setOption(option);
window.addEventListener("resize",function(){
window.addEventListener("resize",function(){
myChartCpu.resize();
});
},'json');
@@ -318,20 +324,14 @@ function mem(b,e){
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
},
axisPointer: { type: 'cross' },
formatter: '{b}<br />{a}: {c}%'
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData,
axisLine:{
lineStyle:{
color:"#666"
}
}
axisLine:{ lineStyle:{ color:"#666" } }
},
yAxis: {
type: 'value',
@@ -339,16 +339,8 @@ function mem(b,e){
boundaryGap: [0, '100%'],
min:0,
max: 100,
splitLine:{
lineStyle:{
color:"#ddd"
}
},
axisLine:{
lineStyle:{
color:"#666"
}
}
splitLine:{ lineStyle:{ color:"#ddd" } },
axisLine:{ lineStyle:{ color:"#666" } }
},
dataZoom: [{
type: 'inside',
@@ -375,11 +367,7 @@ function mem(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgb(0, 153, 238)'
}
},
itemStyle: { normal: { color: 'rgb(0, 153, 238)' } },
data: zData
}
]
@@ -423,26 +411,14 @@ function disk(b,e){
type: 'category',
boundaryGap: false,
data: xData,
axisLine:{
lineStyle:{
color:"#666"
}
}
axisLine:{ lineStyle:{ color:"#666" }}
},
yAxis: {
type: 'value',
name: '单位:KB/s',
boundaryGap: [0, '100%'],
splitLine:{
lineStyle:{
color:"#ddd"
}
},
axisLine:{
lineStyle:{
color:"#666"
}
}
splitLine:{ lineStyle:{ color:"#ddd"} },
axisLine:{ lineStyle:{ color:"#666" } }
},
dataZoom: [{
type: 'inside',
@@ -469,11 +445,7 @@ function disk(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgb(255, 70, 131)'
}
},
itemStyle: { normal: { color: 'rgb(255, 70, 131)' } },
data: rData
},
{
@@ -482,11 +454,7 @@ function disk(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgba(46, 165, 186, .7)'
}
},
itemStyle: { normal: { color: 'rgba(46, 165, 186, .7)'} },
data: wData
}
]
@@ -522,9 +490,7 @@ function network(b,e){
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
axisPointer: { type: 'cross' }
},
legend: {
data:[lan.index.net_up,lan.index.net_down]
@@ -533,26 +499,14 @@ function network(b,e){
type: 'category',
boundaryGap: false,
data: xData,
axisLine:{
lineStyle:{
color:"#666"
}
}
axisLine:{ lineStyle:{ color:"#666" } }
},
yAxis: {
type: 'value',
name: lan.index.unit+':KB/s',
boundaryGap: [0, '100%'],
splitLine:{
lineStyle:{
color:"#ddd"
}
},
axisLine:{
lineStyle:{
color:"#666"
}
}
splitLine:{ lineStyle:{ color:"#ddd" } },
axisLine:{ lineStyle:{ color:"#666" } }
},
dataZoom: [{
type: 'inside',
@@ -579,11 +533,7 @@ function network(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgb(255, 140, 0)'
}
},
itemStyle: { normal: { color: 'rgb(255, 140, 0)' } },
data: yData
},
{
@@ -592,11 +542,7 @@ function network(b,e){
smooth:true,
symbol: 'none',
sampling: 'average',
itemStyle: {
normal: {
color: 'rgb(30, 144, 255)'
}
},
itemStyle: { normal: { color: 'rgb(30, 144, 255)' } },
data: zData
}
]
@@ -879,17 +825,8 @@ function getload(b,e){
{
name: '资源使用率%',
type: 'line',
lineStyle: {
normal: {
width: 2,
color: 'rgb(255, 140, 0)'
}
},
itemStyle: {
normal: {
color: 'rgb(255, 140, 0)'
}
},
lineStyle: { normal: { width: 2, color: 'rgb(255, 140, 0)'}},
itemStyle: {normal: { color: 'rgb(255, 140, 0)' }},
data: yData
},
{
@@ -897,17 +834,8 @@ function getload(b,e){
yAxisIndex: 1,
name: '1分钟',
type: 'line',
lineStyle: {
normal: {
width: 2,
color: 'rgb(30, 144, 255)'
}
},
itemStyle: {
normal: {
color: 'rgb(30, 144, 255)'
}
},
lineStyle: { normal: {width: 2,color: 'rgb(30, 144, 255)' }},
itemStyle: { normal: { color: 'rgb(30, 144, 255)'} },
data: zData
},
{
@@ -915,17 +843,8 @@ function getload(b,e){
yAxisIndex: 1,
name: '5分钟',
type: 'line',
lineStyle: {
normal: {
width: 2,
color: 'rgb(0, 178, 45)'
}
},
itemStyle: {
normal: {
color: 'rgb(0, 178, 45)'
}
},
lineStyle: { normal: { width: 2, color: 'rgb(0, 178, 45)'} },
itemStyle: { normal: { color: 'rgb(0, 178, 45)' } },
data: aData
},
{
@@ -933,28 +852,16 @@ function getload(b,e){
yAxisIndex: 1,
name: '15分钟',
type: 'line',
lineStyle: {
normal: {
width: 2,
color: 'rgb(147, 38, 255)'
}
},
itemStyle: {
normal: {
color: 'rgb(147, 38, 255)'
}
},
lineStyle: { normal: { width: 2, color: 'rgb(147, 38, 255)'}},
itemStyle: { normal: { color: 'rgb(147, 38, 255)' } },
data: bData
}
],
textStyle: {
color: '#666',
fontSize: 12
}
textStyle: { color: '#666',fontSize: 12}
}
myChartgetload.setOption(option);
window.addEventListener("resize",function(){
myChartgetload.resize();
})
},'json')
},'json');
}
+10 -17
View File
@@ -789,18 +789,15 @@ function batchPasteTo(data,path){
function getSuffixName(fileName){
var extArr = fileName.split(".");
var exts = ['folder','folder-unempty','sql','c','cpp','cs','flv','css','js',
var exts = ['folder-unempty','sql','c','cpp','cs','flv','css','js',
'htm','html','java','log','mht','url','xml','ai','bmp','cdr','gif','ico',
'jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4',
'jpeg','jpg','JPG','png','psd','webp','ape','avi','mkv','mov','mp3','mp4',
'mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','rtf','docx','fdf','potm',
'pptx','txt','xlsb','xlsx','7z','cab','iso','rar','zip','gz','bt','file','apk','bookfolder',
'folder','folder-empty','folder-unempty','fromchromefolder','documentfolder','fromphonefolder',
'mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb','sql','c',
'cpp','cs','js','fla','flv','htm','html','java','mht','url','xml','ai','bmp','cdr',
'gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg',
'mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf',
'fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso',
'rar','zip','bt','file','apk','css','scss','svg','pl','py','php','md','json','sh'];
'folder','folder-empty','fromchromefolder','documentfolder','fromphonefolder',
'mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb',
'fla','doc','docm','dotx','dotm','dot','pdf',
'ppt','pptm','pot','xls','csv','xlsm','scss','svg','pl','py','php','md','json','sh','conf'];
var extLastName = extArr[extArr.length - 1];
for(var i=0; i<exts.length; i++){
if(exts[i]==extLastName){
@@ -818,13 +815,9 @@ function getExtName(fileName){
'jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4',
'mpeg','mpg','rm','rmvb','swf','wav','webm','wma','wmv','rtf','docx','fdf','potm',
'pptx','txt','xlsb','xlsx','7z','cab','iso','rar','zip','gz','bt','file','apk','bookfolder',
'folder','folder-empty','folder-unempty','fromchromefolder','documentfolder','fromphonefolder',
'mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb','sql','c',
'cpp','cs','js','fla','flv','htm','html','java','log','mht','url','xml','ai','bmp','cdr',
'gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg',
'mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf',
'fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso',
'rar','zip','bt','file','apk','css'];
'folder-empty','fromchromefolder','documentfolder','fromphonefolder',
'mix','musicfolder','picturefolder','videofolder','sefolder','access','mdb','accdb',
'fla','flv','doc','docm','dotx','dotm','dot','pdf','ppt','pptm','pot','xls','csv','xlsm'];
var extLastName = extArr[extArr.length - 1];
for(var i=0; i<exts.length; i++){
if(exts[i]==extLastName){
@@ -842,7 +835,7 @@ function ShowEditMenu(){
$(this).removeClass("hover");
}).click(function(){
$(this).addClass("on").siblings().removeClass("on");
})
});
}
//取磁盘
+234 -63
View File
@@ -233,16 +233,41 @@ function changePathCallback(default_dir, callback) {
closeBtn: 1,
shift: 5,
shadeClose: false,
content: "<div class='changepath'><div class='path-top'><button type='button' class='btn btn-default btn-sm' onclick='backFile()'><span class='glyphicon glyphicon-share-alt'></span>返回</button>\
<div class='place' id='PathPlace'>当前路径:<span></span></div></div><div class='path-con'><div class='path-con-left'><dl><dt id='changecomlist' onclick='backMyComputer()'>计算机</dt></dl></div>\
<div class='path-con-right'><ul class='default' id='computerDefautl'></ul><div class='file-list divtable'>\
<table class='table table-hover' style='border:0 none'>\
<thead><tr class='file-list-head'><th width='40%'>文件名</th><th width='20%'>修改时间</th><th width='10%'>权限</th><th width='10%'>所有者</th><th width='10%'></th></tr></thead>\
<tbody id='tbody' class='list-list'></tbody></table></div></div></div></div><div class='getfile-btn' style='margin-top:0'>\
<button type='button' class='btn btn-default btn-sm pull-left' onclick='createFolder()'>新建文件夹</button>\
<button type='button' class='btn btn-danger btn-sm mr5 btn-close'>关闭</button>\
<button type='button' class='btn btn-success btn-sm btn-choose'>选择</button>\
</div>",
content: "<div class='changepath'>\
<div class='path-top'>\
<button type='button' class='btn btn-default btn-sm' onclick='backFile()'>\
<span class='glyphicon glyphicon-share-alt'></span>返回\
</button>\
<div class='place' id='PathPlace'>当前路径:<span></span></div>\
</div>\
<div class='path-con'>\
<div class='path-con-left'>\
<dl><dt id='changecomlist' onclick='backMyComputer()'>计算机</dt></dl>\
</div>\
<div class='path-con-right'>\
<ul class='default' id='computerDefautl'></ul>\
<div class='file-list divtable'>\
<table class='table table-hover' style='border:0 none'>\
<thead>\
<tr class='file-list-head'>\
<th width='40%'>文件名</th>\
<th width='20%'>修改时间</th>\
<th width='10%'>权限</th>\
<th width='10%'>所有者</th>\
<th width='10%'></th>\
</tr>\
</thead>\
<tbody id='tbody' class='list-list'></tbody>\
</table>\
</div>\
</div>\
</div>\
</div>\
<div class='getfile-btn' style='margin-top:0'>\
<button type='button' class='btn btn-default btn-sm pull-left' onclick='createFolder()'>新建文件夹</button>\
<button type='button' class='btn btn-danger btn-sm mr5 btn-close'>关闭</button>\
<button type='button' class='btn btn-success btn-sm btn-choose'>选择</button>\
</div>",
success:function(layero,layer_index){
$('.btn-close').click(function(){
layer.close(layer_index);
@@ -274,16 +299,38 @@ function changePath(d) {
closeBtn: 1,
shift: 5,
shadeClose: false,
content: "<div class='changepath'><div class='path-top'><button type='button' class='btn btn-default btn-sm' onclick='backFile()'><span class='glyphicon glyphicon-share-alt'></span>返回</button>\
<div class='place' id='PathPlace'>当前路径:<span></span></div></div><div class='path-con'><div class='path-con-left'><dl><dt id='changecomlist' onclick='backMyComputer()'>计算机</dt></dl></div>\
<div class='path-con-right'><ul class='default' id='computerDefautl'></ul><div class='file-list divtable'>\
<table class='table table-hover' style='border:0 none'>\
<thead><tr class='file-list-head'><th width='40%'>文件名</th><th width='20%'>修改时间</th><th width='10%'>权限</th><th width='10%'>所有者</th><th width='10%'></th></tr></thead>\
<tbody id='tbody' class='list-list'></tbody></table></div></div></div></div><div class='getfile-btn' style='margin-top:0'>\
content: "\
<div class='changepath'>\
<div class='path-top'>\
<button type='button' class='btn btn-default btn-sm' onclick='backFile()'><span class='glyphicon glyphicon-share-alt'></span>返回</button>\
<div class='place' id='PathPlace'>当前路径:<span></span></div>\
</div>\
<div class='path-con'>\
<div class='path-con-left'><dl><dt id='changecomlist' onclick='backMyComputer()'>计算机</dt></dl></div>\
<div class='path-con-right'>\
<ul class='default' id='computerDefautl'></ul>\
<div class='file-list divtable'>\
<table class='table table-hover' style='border:0 none'>\
<thead>\
<tr class='file-list-head'>\
<th width='40%'>文件名</th>\
<th width='20%'>修改时间</th>\
<th width='10%'>权限</th>\
<th width='10%'>所有者</th>\
<th width='10%'></th>\
</tr>\
</thead>\
<tbody id='tbody' class='list-list'></tbody>\
</table>\
</div>\
</div>\
</div>\
</div>\
<div class='getfile-btn' style='margin-top:0'>\
<button type='button' class='btn btn-default btn-sm pull-left' onclick='createFolder()'>新建文件夹</button>\
<button type='button' class='btn btn-danger btn-sm mr5' onclick=\"layer.close(getCookie('changePath'))\">关闭</button>\
<button type='button' class='btn btn-success btn-sm' onclick='getfilePath()'>选择</button>\
</div>"
</div>"
});
setCookie("changePath", c);
var b = $("#" + d).val();
@@ -323,7 +370,13 @@ function getDiskList(b) {
e = e.substring(0, 10) + "..."
}
}
d += "<tr><td onclick=\"getDiskList('" + h.PATH + "/" + g[0] + "')\" title='" + g[0] + "'><span class='glyphicon glyphicon-folder-open'></span>" + e + "</td><td>" + getLocalTime(g[2]) + "</td><td>" + g[3] + "</td><td>" + g[4] + "</td><td><span class='delfile-btn' onclick=\"NewDelFile('" + h.PATH + "/" + g[0] + "')\">X</span></td></tr>"
d += "<tr>\
<td onclick=\"getDiskList('" + h.PATH + "/" + g[0] + "')\" title='" + g[0] + "'>\
<span class='glyphicon glyphicon-folder-open'></span>" + e + "</td><td>" + getLocalTime(g[2]) + "</td>\
<td>" + g[3] + "</td>\
<td>" + g[4] + "</td>\
<td><span class='delfile-btn' onclick=\"NewDelFile('" + h.PATH + "/" + g[0] + "')\">X</span></td>\
</tr>";
}
if(h.FILES != null && h.FILES != "") {
for(var f = 0; f < h.FILES.length; f++) {
@@ -337,7 +390,13 @@ function getDiskList(b) {
e = e.substring(0, 10) + "..."
}
}
d += "<tr><td title='" + g[0] + "'><span class='glyphicon glyphicon-file'></span>" + e + "</td><td>" + getLocalTime(g[2]) + "</td><td>" + g[3] + "</td><td>" + g[4] + "</td><td></td></tr>"
d += "<tr>\
<td title='" + g[0] + "'><span class='glyphicon glyphicon-file'></span>" + e + "</td>\
<td>" + getLocalTime(g[2]) + "</td>\
<td>" + g[3] + "</td>\
<td>" + g[4] + "</td>\
<td></td>\
</tr>";
}
}
$(".default").hide();
@@ -720,7 +779,12 @@ function safeMessage(j, h, g, f) {
area: "350px",
closeBtn: 1,
shadeClose: true,
content: "<div class='bt-form webDelete pd20 pb70'><p>" + h + "</p>" + f + "<div class='vcode'>"+lan.bt.cal_msg+"<span class='text'>" + sumtext + "</span>=<input type='number' id='vcodeResult' value=''></div><div class='bt-form-submit-btn'><button type='button' class='btn btn-danger btn-sm bt-cancel'>"+lan.public.cancel+"</button> <button type='button' id='toSubmit' class='btn btn-success btn-sm' >"+lan.public.ok+"</button></div></div>"
content: "<div class='bt-form webDelete pd20 pb70'>\
<p>" + h + "</p>" + f + "<div class='vcode'>"+lan.bt.cal_msg+"<span class='text'>" + sumtext + "</span>=<input type='number' id='vcodeResult' value=''></div>\
<div class='bt-form-submit-btn'>\
<button type='button' class='btn btn-danger btn-sm bt-cancel'>"+lan.public.cancel+"</button>\
<button type='button' id='toSubmit' class='btn btn-success btn-sm' >"+lan.public.ok+"</button></div>\
</div>"
});
$("#vcodeResult").focus().keyup(function(a) {
if(a.keyCode == 13) {
@@ -856,16 +920,32 @@ function GetTaskList(a) {
case "-1":
f = true;
if(g.data[d].type != "download") {
b = "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state'>正在安装 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span><span class='opencmd'></span><pre class='cmd'></pre></li>"
b = "<li>\
<span class='titlename'>" + g.data[d].name + "</span>\
<span class='state'>正在安装 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span>\
<span class='opencmd'></span><pre class='cmd'></pre>\
</li>";
} else {
b = "<li><div class='line-progress' style='width:0%'></div><span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span><span class='com-progress'>0%</span><span class='state'>下载中 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">"+lan.public.close+"</a></span></li>"
b = "<li>\
<div class='line-progress' style='width:0%'></div>\
<span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span>\
<span class='com-progress'>0%</span><span class='state'>\
下载中 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">"+lan.public.close+"</a>\
</span>\
</li>";
}
break;
case "0":
c += "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state'>等待</span> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">删除</a></li>";
c += "<li>\
<span class='titlename'>" + g.data[d].name + "</span>\
<span class='state'>等待</span> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">删除</a>\
</li>";
break;
case "1":
e += "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state'>" + g.data[d].addtime + " "+'已完成'+" "+ '耗时' + (g.data[d].end - g.data[d].start)+"秒</span></li>"
e += "<li>\
<span class='titlename'>" + g.data[d].name + "</span>\
<span class='state'>" + g.data[d].addtime + " "+'已完成'+" "+ '耗时' + (g.data[d].end - g.data[d].start)+"秒</span>\
</li>";
}
}
$("#srunning").html(b + c);
@@ -1070,7 +1150,8 @@ function bindPanel(a,type,ip,btid,url,user,pw){
btn = "<button type='button' class='btn btn-success btn-sm' onclick=\"bindPanel(1,'b')\">添加</button>";
} else {
titleName = '修改关联' + ip;
btn = "<button type='button' class='btn btn-default btn-sm' onclick=\"bindPaneldel('"+btid+"')\">删除</button><button type='button' class='btn btn-success btn-sm' onclick=\"bindPanel(1,'c','"+ip+"','"+btid+"')\" style='margin-left:7px'>修改</button>";
btn = "<button type='button' class='btn btn-default btn-sm' onclick=\"bindPaneldel('"+btid+"')\">删除</button>\
<button type='button' class='btn btn-success btn-sm' onclick=\"bindPanel(1,'c','"+ip+"','"+btid+"')\" style='margin-left:7px'>修改</button>";
}
if(url == undefined) url="http://";
if(user == undefined) user="";
@@ -1255,13 +1336,37 @@ function remind(a){
for(var d = 0; d < g.data.length; d++) {
if(g.data[d].status != '1'){
task_count++;
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_the+'】<span><span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
e += '<tr>\
<td><input type="checkbox"></td>\
<td>\
<div class="titlename c3">\
<span>'+g.data[d].name+'</span>\
<span class="rs-status">【'+lan.bt.task_the+'】<span>\
<span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span>\
</div>\
</td>\
<td class="text-right c3">'+g.data[d].addtime+'</td>\
</tr>';
} else{
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>';
e += '<tr>\
<td><input type="checkbox"></td>\
<td>\
<div class="titlename c3">'+g.data[d].name+'</span>\
<span class="rs-status">【'+lan.bt.task_ok+'】<span>\
<span class="rs-time">耗时['+ getSFM(g.data[d].end - g.data[d].start) +']</span>\
</div>\
</td>\
<td class="text-right c3">'+g.data[d].addtime+'</td>\
</tr>';
}
}
var con = '<div class="divtable"><table class="table table-hover">\
<thead><tr><th width="20"><input id="Rs-checkAll" type="checkbox" onclick="RscheckSelect()"></th><th>'+lan.bt.task_name+'</th><th class="text-right">'+lan.bt.task_time+'</th></tr></thead>\
<thead>\
<tr>\
<th width="20"><input id="Rs-checkAll" type="checkbox" onclick="RscheckSelect()"></th>\
<th>'+lan.bt.task_name+'</th><th class="text-right">'+lan.bt.task_time+'</th>\
</tr>\
</thead>\
<tbody id="remind">'+e+'</tbody>\
</table></div>\
<div class="mtb15" style="height:32px">\
@@ -1325,12 +1430,26 @@ function getReloads() {
c += f[e] + "<br>"
}
if(h.task[g].name.indexOf("扫描") != -1) {
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在扫描<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span><span class='opencmd'></span><div class='cmd'>" + c + "</div></li>"
b = "<li>\
<span class='titlename'>" + h.task[g].name + "</span>\
<span class='state'>正在扫描<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span>\
<span class='opencmd'></span>\
<div class='cmd'>" + c + "</div>\
</li>";
} else {
b = "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>正在安装<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span><div class='cmd'>" + c + "</div></li>"
b = "<li>\
<span class='titlename'>" + h.task[g].name + "</span>\
<span class='state'>正在安装<img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">关闭</a></span>\
<div class='cmd'>" + c + "</div>\
</li>";
}
} else {
b = "<li><div class='line-progress' style='width:" + h.msg.pre + "%'></div><span class='titlename'>" + h.task[g].name + "<a style='margin-left:130px;'>" + (toSize(h.msg.used) + "/" + toSize(h.msg.total)) + "</a></span><span class='com-progress'>" + h.msg.pre + "%</span><span class='state'>"+lan.bt.task_downloading+" <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">"+lan.public.close+"</a></span></li>"
b = "<li>\
<div class='line-progress' style='width:" + h.msg.pre + "%'></div>\
<span class='titlename'>" + h.task[g].name + "<a style='margin-left:130px;'>" + (toSize(h.msg.used) + "/" + toSize(h.msg.total)) + "</a></span>\
<span class='com-progress'>" + h.msg.pre + "%</span>\
<span class='state'>"+lan.bt.task_downloading+" <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + h.task[g].id + ")\">"+lan.public.close+"</a></span>\
</li>"
}
} else {
d += "<li><span class='titlename'>" + h.task[g].name + "</span><span class='state'>等待 | <a style='color:green' href=\"javascript:removeTask(" + h.task[g].id + ')">删除</a></span></li>'
@@ -1380,14 +1499,24 @@ function tasklist(a){
case "-1":
f = true;
if(g.data[d].type != "download") {
b = "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>正在安装<img src='/static/img/ing.gif'> | <a class='btlink' href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span><span class='opencmd'></span><pre class='cmd'></pre></li>"
b = "<li>\
<span class='titlename'>" + g.data[d].name + "</span>\
<span class='state pull-right c6'>正在安装<img src='/static/img/ing.gif'> | <a class='btlink' href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span>\
<span class='opencmd'></span><pre class='cmd'></pre>\
</li>";
} else {
b = "<li><div class='line-progress' style='width:0%'></div><span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span><span class='com-progress'>0%</span><span class='state'>下载中 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span></li>"
b = "<li>\
<div class='line-progress' style='width:0%'></div><span class='titlename'>" + g.data[d].name + "<a id='speed' style='margin-left:130px;'>0.0M/12.5M</a></span>\
<span class='com-progress'>0%</span><span class='state'>下载中 <img src='/static/img/ing.gif'> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\">关闭</a></span>\
</li>";
}
task_count++;
break;
case "0":
c += "<li><span class='titlename'>" + g.data[d].name + "</span><span class='state pull-right c6'>等待</span> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\" class='btlink'>"+lan.public.del+"</a></li>";
c += "<li>\
<span class='titlename'>" + g.data[d].name + "</span>\
<span class='state pull-right c6'>等待</span> | <a href=\"javascript:removeTask(" + g.data[d].id + ")\" class='btlink'>"+lan.public.del+"</a>\
</li>";
task_count++;
break;
}
@@ -1704,7 +1833,8 @@ function showSpeed(filename) {
* 显示进度窗口
*/
function showSpeedWindow(msg, speed_log_func_name, callback){
var speed_msg = "<pre style='margin-bottom: 0px;height:250px;text-align: left;background-color: #000;color: #fff;white-space: pre-wrap;' id='speed_log_lst'>[MSG]</pre>";
var speed_msg = "<pre style='margin-bottom: 0px;height:250px;text-align: left;background-color: #000;\
color: #fff;white-space: pre-wrap;' id='speed_log_lst'>[MSG]</pre>";
var showSpeedKey = layer.open({
title: false,
type: 1,
@@ -1924,14 +2054,19 @@ function utf8to16(str) {
}
function pluginService(_name, version){
var data = {name:_name, func:'status'}
function pluginService(_name, version, _suffix_name=''){
var default_name = 'status';
if ( _suffix_name != '' ){
default_name = 'status_'+_suffix_name;
}
var data = {name:_name, func:default_name};
if ( typeof(version) != 'undefined' ){
data['version'] = version;
} else {
version = '';
}
// console.log(version);
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
$.post('/plugins/run', data, function(data) {
@@ -1941,27 +2076,39 @@ function pluginService(_name, version){
return;
}
if (data.data == 'start'){
pluginSetService(_name, true, version);
pluginSetService(_name, true, version, _suffix_name);
} else {
pluginSetService(_name, false, version);
pluginSetService(_name, false, version, _suffix_name);
}
},'json');
}
function pluginSetService(_name ,status, version){
function pluginSetService(_name ,status, version, _suffix_name=''){
var default_name = 'status';
var restart_name = 'restart';
var reload_name = 'reload';
var status_ss = (status?'stop':'start');
if ( _suffix_name != '' ){
default_name = 'status_'+_suffix_name;
restart_name = 'restart_'+_suffix_name;
reload_name = 'reload_'+_suffix_name;
status_ss = status_ss+'_'+_suffix_name;
}
var serviceCon ='<p class="status">当前状态:<span>'+(status ? '开启' : '关闭' )+
'</span><span style="color: '+
(status?'#20a53a;':'red;')+
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\''+(status?'stop':'start')+'\',\''+version+'\')">'+(status?'停止':'启动')+'</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\'restart\',\''+version+'\')">重启</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\'reload\',\''+version+'\')">重载配置</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\''+status_ss+'\',\''+version+'\',\''+_suffix_name+'\')">'+(status?'停止':'启动')+'</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\''+restart_name+'\',\''+version+'\',\''+_suffix_name+'\')">重启</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpService(\''+_name+'\',\''+reload_name+'\',\''+version+'\',\''+_suffix_name+'\')">重载配置</button>\
</div>';
$(".soft-man-con").html(serviceCon);
}
function pluginOpService(a, b, v) {
function pluginOpService(a, b, v, _suffix_name='') {
var c = "name=" + a + "&func=" + b;
if(v != ''){
@@ -1969,26 +2116,33 @@ function pluginOpService(a, b, v) {
}
var d = "";
b = b.split('_')[0];
switch(b) {
case "stop":d = '停止';break;
case "start":d = '启动';break;
case "restart":d = '重启';break;
case "reload":d = '重载';break;
}
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,v]), {icon:3,closeBtn: 1}, function() {
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,v]), {icon: 16,time: 0});
_ver = v;
if(v != ''){
_ver = '【' + v + '】';
}
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,_ver]), {icon:3,closeBtn: 1}, function() {
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,_ver]), {icon: 16,time: 0});
$.post("/plugins/run", c, function(g) {
layer.close(e);
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,v,d]) : msgTpl('{1}{2}服务{3}失败!',[a,v,d]);
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,_ver,d]) : msgTpl('{1}{2}服务{3}失败!',[a,_ver,d]);
layer.msg(f, {icon: g.data == 'ok' ? 1 : 2});
if( b != "reload" && g.data == 'ok' ) {
if ( b == 'start' ) {
pluginSetService(a, true, v);
pluginSetService(a, true, v, _suffix_name);
} else if ( b == 'stop' ){
pluginSetService(a, false, v);
pluginSetService(a, false, v, _suffix_name);
}
}
@@ -2209,14 +2363,18 @@ function pluginConfigSave(fileName) {
},'json');
}
function pluginInitD(_name,_version){
function pluginInitD(_name, _version, _suffix_name=''){
if (typeof _version == 'undefined'){
_version = '';
}
var default_name = 'initd_status';
if ( _suffix_name != '' ){
default_name = 'initd_status_'+_suffix_name;
}
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
$.post('/plugins/run', {name:_name, func:'initd_status',version : _version}, function(data) {
$.post('/plugins/run', {name:_name, func:default_name, version : _version}, function(data) {
layer.close(loadT);
if( !data.status ){
layer.msg(data.msg,{icon:0,time:3000,shade: [0.3, '#000']});
@@ -2227,35 +2385,48 @@ function pluginInitD(_name,_version){
return;
}
if (data.data == 'ok'){
pluginSetInitD(_name, _version, true);
pluginSetInitD(_name, _version, true, _suffix_name);
} else {
pluginSetInitD(_name, _version, false);
pluginSetInitD(_name, _version, false, _suffix_name);
}
},'json');
}
function pluginSetInitD(_name, _version, status){
function pluginSetInitD(_name, _version, status,_suffix_name=''){
var default_name = (status?'initd_uninstall':'initd_install');
if ( _suffix_name != '' ){
default_name = default_name + '_' + _suffix_name;
}
var serviceCon ='<p class="status">当前状态:<span>'+(status ? '已加载' : '未加载' )+
'</span><span style="color: '+
(status?'#20a53a;':'red;')+
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
<button class="btn btn-default btn-sm" onclick="pluginOpInitD(\''+_name+'\',\''+_version+'\',\''+(status?'initd_uninstall':'initd_install')+'\')">'+(status?'卸载':'加载')+'</button>\
<button class="btn btn-default btn-sm" onclick="pluginOpInitD(\''+_name+'\',\''+_version+'\',\''+default_name+'\',\''+_suffix_name+'\')">'+(status?'卸载':'加载')+'</button>\
</div>';
$(".soft-man-con").html(serviceCon);
}
function pluginOpInitD(a, _version, b) {
function pluginOpInitD(a, _version, b, _suffix_name='') {
var c = "name=" + a + "&func=" + b + "&version="+_version;
var d = "";
b = b.split('_'+_suffix_name)[0];
switch(b) {
case "initd_install":d = '加载';break;
case "initd_uninstall":d = '卸载';break;
}
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,_version]), {icon:3,closeBtn: 1}, function() {
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,_version]), {icon: 16,time: 0});
_ver = _version;
if(_version != ''){
_ver = '【' + _version + '】';
}
layer.confirm( msgTpl('您真的要{1}{2}{3}服务吗?', [d,a,_ver]), {icon:3,closeBtn: 1}, function() {
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,_ver]), {icon: 16,time: 0});
$.post("/plugins/run", c, function(g) {
layer.close(e);
var f = g.data == 'ok' ? msgTpl('{1}{3}服务已{2}',[a,d,_version]) : msgTpl('{1}{3}服务{2}失败!',[a,d,_version]);
var f = g.data == 'ok' ? msgTpl('{1}{3}服务已{2}',[a,d,_ver]) : msgTpl('{1}{3}服务{2}失败!',[a,d,_ver]);
layer.msg(f, {icon: g.data == 'ok' ? 1 : 2});
if ( b == 'initd_install' && g.data == 'ok' ) {
+310 -155
View File
@@ -4,8 +4,8 @@
* @param {String} search 搜索条件
*/
function getWeb(page, search, type_id) {
search = $("#SearchValue").prop("value");
page = page == undefined ? '1':page;
var search = $("#SearchValue").prop("value");
var page = page == undefined ? '1':page;
var order = getCookie('order');
if(order){
order = '&order=' + order;
@@ -127,7 +127,7 @@
if(databak == null){
databak = '';
}
$(this).hide().after("<input class='baktext' type='text' data-id='"+dataid+"' name='bak' value='" + databak + "' placeholder='备注信息' onblur='getBakPost(\"sites\")' />");
$(this).hide().after("<input class='baktext' type='text' data-id='"+dataid+"' data-page='"+page+"' name='bak' value='" + databak + "' placeholder='备注信息' onblur='getBakPost(\"sites\")' />");
$(".baktext").focus();
});
@@ -138,22 +138,23 @@
function getBakPost(b) {
$(".baktext").hide().prev().show();
var c = $(".baktext").attr("data-id");
var id = $(".baktext").attr("data-id");
var page = $(".baktext").attr("data-page");
var a = $(".baktext").val();
if(a == "") {
a = '空';
}
setWebPs(b, c, a);
$("a[data-id='" + c + "']").html(a);
setWebPs(b, id, a,page);
$("a[data-id='" + id + "']").html(a);
$(".baktext").remove();
}
function setWebPs(b, e, a) {
function setWebPs(b, id, ps,page) {
var d = layer.load({shade: true,shadeClose: false});
var c = 'ps=' + a;
$.post('/site/set_ps', 'id=' + e + "&" + c, function(data) {
var ps = 'ps=' + ps;
$.post('/site/set_ps', 'id=' + id + "&" + ps, function(data) {
if(data['status']) {
getWeb(1);
getWeb(page);
layer.closeAll();
layer.msg('修改成功!', {icon: 1});
} else {
@@ -1300,7 +1301,7 @@ function showRewrite(rdata){
<select class='bt-input-text mr20' id='myRewrite' name='rewrite' style='width:30%;'>"+rList+"</select>\
<textarea class='bt-input-text mtb15' style='height: 260px; width: 470px; line-height:18px;padding:5px;' id='rewriteBody'>"+rdata.data+"</textarea>\
</div>\
<button id='SetRewriteBtn' class='btn btn-success btn-sm' onclick=\"SetRewrite('"+rdata.filename+"')\">保存</button>\
<button id='setRewriteBtn' class='btn btn-success btn-sm'>保存</button>\
<ul class='help-info-text c7 ptb10'>\
<li>请选择您的应用,若设置伪静态后,网站无法正常访问,请尝试设置回default</li>\
<li>您可以对伪静态规则进行修改,修改完后保存即可。</li>\
@@ -1313,14 +1314,21 @@ function showRewrite(rdata){
closeBtn: 1,
shift: 5,
shadeClose: true,
content:webBakHtml
});
$("#myRewrite").change(function(){
var rewriteName = $(this).val();
$.post('/files/get_body','path='+rdata['rewrite_dir']+'/'+rewriteName+'.conf',function(fileBody){
$("#rewriteBody").val(fileBody.data.data);
},'json');
content:webBakHtml,
success:function(){
$("#myRewrite").change(function(){
var rewriteName = $(this).val();
$.post('/files/get_body','path='+rdata['rewrite_dir']+'/'+rewriteName+'.conf',function(fileBody){
$("#rewriteBody").val(fileBody.data.data);
},'json');
});
$('#setRewriteBtn').click(function(){
var data = $("#rewriteBody").val();
setRewrite(rdata.filename, encodeURIComponent(data));
});
}
});
}
@@ -1333,7 +1341,7 @@ function addDirBinding(id){
return;
}
var data = 'id='+id+'&domain='+domain+'&dirName='+dirName
var data = 'id='+id+'&domain='+domain+'&dirName='+dirName;
$.post('/site/add_dir_bind',data,function(rdata){
dirBinding(id);
layer.msg(rdata.msg,{icon:rdata.status?1:2});
@@ -1553,82 +1561,164 @@ function to301(siteName, type, obj){
}
function toProxySwitch(){
var status = $("input[name='open_proxy']").prop("checked")==true?1:0;
if(status==1){
$("input[name='open_proxy']").prop("checked",false);
}else{
$("input[name='open_proxy']").prop("checked",true);
}
}
//反向代理
function toProxy(siteName, type, obj) {
// 设置 页面展示
if(type == 1) {
var proxy_form = layer.open({
var proxy_title = "创建反向代理";
if (typeof(obj) != 'undefined'){
proxy_title = "编辑反向代理";
}
layer.open({
type: 1,
area: '650px',
title: "创建反向代理",
title: proxy_title,
closeBtn: 1,
shift: 5,
shadeClose: false,
btn: ['提交','关闭'],
content: "<form id='form_redirect' class='divtable pd15' style='padding-bottom: 10px'>" +
"<div class='line'>" +
'<span class="tname">开启代理</span>'+
"<div class='info-r ml0'>" +
"<input name='open_proxy' class='btswitch btswitch-ios' type='checkbox' checked><label id='open_proxy' class='btswitch-btn' for='openProxy' onclick='toProxySwitch();'></label>" +
"</div>" +
"</div>" +
"<div class='line'>"+
"<span class='tname'>代理目录</span>" +
"<div class='info-r ml0'>" +
"<input name='from' value='/' placeholder='/' class='bt-input-text mr5' type='text' style='width:200px''>" +
"</div>" +
"</div>" +
"<div class='line'>" +
"<span class='tname'>目标URL</span>" +
"<div class='info-r ml0'>" +
"<input name='to' class='bt-input-text mr5' type='text' style='width:200px;float: left;margin-right:0px''>" +
"<span class='tname' style='width:90px'>发送域名</span>" +
"<input name='host' value='$host' class='bt-input-text mr5' type='text' style='width:200px'>" +
"</div>" +
"</div>" +
"<div class='help-info-text c7'>" +
"<ul class='help-info-text c7'>" +
"<li>代理目录:访问这个目录时将会把目标URL的内容返回并显示</li>" +
"<li>目标URL:可以填写你需要代理的站点,目标URL必须为可正常访问的URL,否则将返回错误</li>" +
"<li>发送域名:将域名添加到请求头传递到代理服务器,默认为目标URL域名,若设置不当可能导致代理无法正常运行</li>" +
"</ul>" +
"</div>" +
"</form>",
yes:function(){
var data = $('#form_redirect').serializeArray();
content: "<form id='form_proxy' class='divtable pd15' style='padding-bottom: 10px'>\
<div class='line'>\
<span class='tname'>开启代理</span>\
<div class='info-r ml0 mt5'>\
<input name='open_proxy' class='btswitch btswitch-ios' type='checkbox' checked>\
<label id='open_proxy' class='btswitch-btn' for='openProxy' style='float:left'></label>\
<div style='display: inline-block'>\
<span class='tname' style='margin-left:15px;position: relative;top: -5px;'>是否缓存</span>\
<input class='btswitch btswitch-ios' type='checkbox' name='open_cache'>\
<label class='btswitch-btn' id='open_cache' for='openCache' style='float:left'></label>\
</div>\
</div>\
</div>\
<div class='line'>\
<span class='tname'>名称</span>\
<div class='info-r ml0'>\
<input name='name' value='index' placeholder='请输入名称' class='bt-input-text mr5' type='text' style='width:200px''>\
</div>\
</div>\
<div class='line' style='display:none' id='cache_time'>\
<span class='tname'>缓存时间</span>\
<div class='info-r ml0'>\
<input name='cache_time' value='1' class='bt-input-text mr5' type='text' style='width:200px''>分钟\
</div>\
</div>\
<div class='line'>\
<span class='tname'>代理目录</span>\
<div class='info-r ml0'>\
<input name='from' value='/' placeholder='/' class='bt-input-text mr5' type='text' style='width:200px''>\
</div>\
</div>\
<div class='line'>\
<span class='tname'>目标URL</span>\
<div class='info-r ml0'>\
<input name='to' class='bt-input-text mr5' type='text' style='width:200px;float: left;margin-right:0px''>\
<span class='tname' style='width:90px'>发送域名</span>\
<input name='host' value='$host' class='bt-input-text mr5' type='text' style='width:200px'>\
</div>\
</div>\
<input name='id' value='' type='hidden'>\
<div class='help-info-text c7'>\
<ul class='help-info-text c7'>\
<li>代理目录:访问这个目录时将会把目标URL的内容返回并显示</li>\
<li>目标URL:可以填写你需要代理的站点,目标URL必须为可正常访问的URL,否则将返回错误</li>\
<li>发送域名:将域名添加到请求头传递到代理服务器,默认为目标URL域名,若设置不当可能导致代理无法正常运行</li>\
</ul>\
</div>\
</form>",
success:function(){
if (typeof(obj) != 'undefined'){
// console.log(obj);
$('input[name="name"]').val(obj['name']).attr('readonly','readonly').addClass('disabled');
if (obj['open_cache'] == 'on'){
$("input[name='open_cache']").prop("checked",true);
$('#cache_time').show();
}
$('input[name="from"]').val(obj['from']);
$('input[name="to"]').val(obj['to']);
var url = obj['to'];
var ip_reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
url = url.replace(/^http[s]?:\/\//, '');
url = url.replace(/(:|\?|\/|\\)(.*)$/, '');
if (ip_reg.test(url)) {
$("[name='host']").val('$host');
} else {
$("[name='host']").val(url);
}
$('input[name="id"]').val(obj['id']);
$('input[name="cache_time"]').val(obj['cache_time']);
}
$('input[name="to"]').on('keyup', function(){
var url = $(this).val();
var ip_reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
url = url.replace(/^http[s]?:\/\//, '');
url = url.replace(/(:|\?|\/|\\)(.*)$/, '');
if (ip_reg.test(url)) {
$("[name='host']").val('$host');
} else {
$("[name='host']").val(url);
}
});
$("#open_proxy").click(function(){
var status = $("input[name='open_proxy']").prop("checked")==true?1:0;
if(status==1){
$("input[name='open_proxy']").prop("checked",false);
}else{
$("input[name='open_proxy']").prop("checked",true);
}
});
$('#open_cache').click(function(){
var status = $("input[name='open_cache']").prop("checked")==true?1:0;
if(status==1){
$('#cache_time').hide();
$("input[name='open_cache']").prop("checked",false);
}else{
$('#cache_time').show();
$("input[name='open_cache']").prop("checked",true);
}
});
},
yes:function(index,layer_ro){
var data = $('#form_proxy').serializeArray();
var t = {};
t['name'] = 'siteName';
t['value'] = siteName;
data.push(t);
var loading = layer.msg('添加中...',{icon:16,time:0,shade: [0.3, '#000']});
// console.log(data);
var loading = layer.msg('正在'+proxy_title+'...',{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/set_proxy',data, function(res) {
layer.close(loading);
if (res.status) {
layer.close(proxy_form);
toProxy(siteName)
} else {
layer.msg(res.msg, {icon: 2});
if (!res.status){
layer.msg(res.msg, {icon: 2,time:10000});
return;
}
showMsg(proxy_title+"成功!",function(){
layer.close(index);
toProxy(siteName);
},{icon: 1, time:2000});
},'json');
}
});
}
if (type == 2) {
var loading = layer.msg('正在删除中...',{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/del_proxy', {siteName: siteName,id: obj,}, function(res) {
layer.close(loading);
if (res.status == true) {
layer.msg('删除成功', {time: 1000,icon: 1});
toProxy(siteName)
showMsg('删除成功', function(){
toProxy(siteName);
},{time: 1000,icon: 1});
} else {
layer.msg(res.msg, {time: 1000,icon: 2});
}
@@ -1642,90 +1732,118 @@ function toProxy(siteName, type, obj) {
var data = {siteName: siteName,id: obj};
$.post('/site/get_proxy_conf', data, function(res) {
layer.close(laoding);
if (res.status == true) {
var mBody = "<div class='webEdit-box' style='padding: 20px'>\
<textarea style='height: 320px; width: 445px; margin-left: 20px; line-height:18px' id='configProxyBody'>"+res.data.result+"</textarea>\
<div class='info-r'>\
<ul class='help-info-text c7 ptb10'>\
<li>此处为反向代理配置文件,若您不了解配置规则,请勿随意修改.</li>\
</ul>\
</div>\
</div>";
var editor;
var index = layer.open({
type: 1,
title: '编辑配置文件',
closeBtn: 1,
shadeClose: true,
area: ['500px', '500px'],
btn: ['提交','关闭'],
content: mBody,
success: function () {
editor = CodeMirror.fromTextArea(document.getElementById("configProxyBody"), {
extraKeys: {"Ctrl-Space": "autocomplete"},
lineNumbers: true,
matchBrackets:true,
});
editor.focus();
$(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
$("#onlineEditFileBtn").unbind('click');
},
yes:function(index,layero){
$("#configProxyBody").empty().text(editor.getValue());
var load = layer.load();
var data = {
siteName: siteName,
id: obj,
config: editor.getValue(),
};
$.post('/site/save_proxy_conf', data, function(res) {
layer.close(load)
if (res.status == true) {
layer.msg('保存成功', {icon: 1});
layer.close(index);
} else {
layer.msg(res.msg, {time: 3000,icon: 2});
}
},'json');
return true;
},
});
} else {
if (!res.status){
layer.msg('请求错误!!', {time: 3000,icon: 2});
return;
}
var mBody = "<div class='webEdit-box' style='padding: 20px'>\
<textarea style='height: 320px; width: 445px; margin-left: 20px; line-height:18px' id='configProxyBody'>"+res.data.result+"</textarea>\
<div class='info-r'>\
<ul class='help-info-text c7 ptb10'>\
<li>此处为反向代理配置文件,若您不了解配置规则,请勿随意修改.</li>\
</ul>\
</div>\
</div>";
var editor;
var index = layer.open({
type: 1,
title: '编辑配置文件',
closeBtn: 1,
shadeClose: true,
area: ['500px', '500px'],
btn: ['提交','关闭'],
content: mBody,
success: function () {
editor = CodeMirror.fromTextArea(document.getElementById("configProxyBody"), {
extraKeys: {"Ctrl-Space": "autocomplete"},
lineNumbers: true,
matchBrackets:true,
});
editor.focus();
$(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
$("#onlineEditFileBtn").unbind('click');
},
yes:function(index,layero){
$("#configProxyBody").empty().text(editor.getValue());
var load = layer.load();
var data = {
siteName: siteName,
id: obj,
config: editor.getValue(),
};
$.post('/site/save_proxy_conf', data, function(res) {
layer.close(load)
if (res.status == true) {
layer.msg('保存成功', {icon: 1});
layer.close(index);
} else {
layer.msg(res.msg, {time: 3000,icon: 2});
}
},'json');
return true;
},
});
},'json');
return
return;
}
if (type == 10 || type == 11) {
//[11]启动 或 停止[10]
status = type==10 ? '0' : '1';
var loading = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/set_proxy_status', {siteName: siteName,'status':status,'id':obj}, function(res) {
$.post('/site/set_proxy_status', {siteName: siteName,'status':status,'id':obj}, function(rdata) {
layer.close(loading);
if (res.status == true) {
layer.msg('设置成功', {icon: 1});
toProxy(siteName);
} else {
if (!rdata.status){
layer.msg(res.msg, {time: 3000,icon: 2});
return;
}
showMsg("设置成功",function(){
toProxy(siteName);
},{icon: 1,time:2000});
},'json');
return;
}
if (type == 20 || type == 21) {
//[20] 开始缓存 或 [21] 停止缓存
var status = type == 20 ? 'on' : '';
obj['open_cache'] = status;
obj['siteName'] = siteName;
var loading = layer.msg('正在提交请求...',{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/set_proxy',obj, function(rdata) {
layer.close(loading);
if (!rdata.status){
layer.msg(rdata.msg, {icon: 2,time:2000});
return;
}
showMsg("设置成功!",function(){
toProxy(siteName);
},{icon: 1, time:2000});
},'json');
return;
}
var body = '<div id="proxy_list" class="bt_table">\
<div style="padding-bottom: 10px">\
<button type="button" title="添加反向代理" class="btn btn-success btn-sm mr5" onclick="toProxy(\''+siteName+'\',1)" ><span>添加反向代理</span></button>\
<button type="button" title="添加反向代理" class="btn btn-success btn-sm mr5" onclick="toProxy(\''+siteName+'\',1)" >\
<span>添加反向代理</span>\
</button>\
</div>\
<div class="divtable" style="max-height:200px;">\
<table class="table table-hover" >\
<thead style="position: relative;z-index: 1;">\
<tr>\
<th><span data-index="1"><span>代理目录</span></span></th>\
<th><span data-index="2"><span>目标地址</span></span></th>\
<th><span data-index="2"><span>状态</span></span></th>\
<th><span data-index="3"><span>操作</span></span></th>\
<th>名称</th>\
<th>代理目录</th>\
<th>目标地址</th>\
<th>缓存</th>\
<th>状态</th>\
<th>操作</th>\
</tr>\
</thead>\
<tbody id="md-301-body"></tbody>\
@@ -1737,28 +1855,64 @@ function toProxy(siteName, type, obj) {
var loading = layer.msg(lan.site.the_msg,{icon:16,time:0,shade: [0.3, '#000']});
$.post("/site/get_proxy_list", {siteName: siteName},function (res) {
layer.close(loading);
if (res.status === true) {
let data = res.data.result;
data.forEach(function(item){
var switchProxy = '<span onclick="toProxy(\''+siteName+'\', 10, \''+ item.id +'\')" style="color:rgb(92, 184, 92);" class="btlink glyphicon glyphicon-play"></span>';
if (!item['status']){
switchProxy = '<span onclick="toProxy(\''+siteName+'\', 11, \''+ item.id +'\')" style="color:rgb(255, 0, 0);" class="btlink glyphicon glyphicon-pause"></span>';
}
let tmp = '<tr>\
<td><span data-index="1"><span>'+item.from+'</span></span></td>\
<td><span data-index="2"><span>'+item.to+'</span></span></td>\
<td>'+switchProxy+'</td>\
<td>\
<span data-index="4" onclick="toProxy(\''+siteName+'\', 3, \''+ item.id +'\')" class="btlink">详细</span> |\
<span data-index="4" onclick="toProxy(\''+siteName+'\', 2, \''+ item.id +'\')" class="btlink">删除</span>\
</td>\
</tr>';
$("#md-301-body").append(tmp);
})
} else {
if (!res.status){
layer.msg(res.msg, {icon:2});
return;
}
var data = res.data.result;
for (var i = 0; i < data.length; i++) {
var item = data[i];
var switchProxy = '<span onclick="toProxy(\''+siteName+'\', 10, \''+ item.id +'\')" style="color:rgb(92, 184, 92);" class="btlink glyphicon glyphicon-play"></span>';
if (!item['status']){
switchProxy = '<span onclick="toProxy(\''+siteName+'\', 11, \''+ item.id +'\')" style="color:rgb(255, 0, 0);" class="btlink glyphicon glyphicon-pause"></span>';
}
var openCache = '<span data-index="'+i+'" class="btlink cache off">未开启</span>';
if (item['open_cache'] == 'on'){
openCache = '<span data-index="'+i+'" class="btlink cache on">已开启</span>';
}
let tmp = '<tr>\
<td>'+item.name+'</td>\
<td>'+item.from+'</td>\
<td>'+item.to+'</td>\
<td>'+openCache+'</td>\
<td>'+switchProxy+'</td>\
<td>\
<span data-index="'+i+'" class="btlink detail">详细</span> |\
<span data-index="'+i+'" class="btlink edit">编辑</span> |\
<span data-index="'+i+'" class="btlink delete">删除</span>\
</td>\
</tr>';
$("#md-301-body").append(tmp);
}
$('#md-301-body .detail').click(function(){
var index = $(this).data('index');
toProxy(siteName, 3 ,data[index]['id']);
});
$('#md-301-body .edit').click(function(){
var index = $(this).data('index');
toProxy(siteName, 1 ,data[index]);
});
$('#md-301-body .delete').click(function(){
var index = $(this).data('index');
toProxy(siteName, 2 ,data[index]['id']);
});
$('#md-301-body .cache').click(function(){
var index = $(this).data('index');
if ($(this).hasClass('on')){
toProxy(siteName, 21 ,data[index]);
} else{
toProxy(siteName, 20 ,data[index]);
}
});
},'json');
/////////
}
@@ -1771,7 +1925,8 @@ function sslAdmin(siteName){
var rdata = data['data'];
var tbody = '';
for(var i=0;i<rdata.length;i++){
tbody += '<tr><td>'+rdata[i].subject+'</td>\
tbody += '<tr>\
<td>'+rdata[i].subject+'</td>\
<td>'+rdata[i].dns.join('<br>')+'</td>\
<td>'+rdata[i].notAfter+'</td>\
<td>'+rdata[i].issuer.split(' ')[0]+'</td>\
@@ -2427,7 +2582,7 @@ function rewrite(siteName){
$("#SetRewriteBtn").click(function(){
$("#rewriteBody").empty();
$("#rewriteBody").text(editor.getValue());
setRewrite(filename);
setRewrite(filename, encodeURIComponent(editor.getValue()));
});
$("#SetRewriteBtnTel").click(function(){
$("#rewriteBody").empty();
@@ -2459,8 +2614,8 @@ function rewrite(siteName){
//设置伪静态
function setRewrite(filename){
var data = 'data='+encodeURIComponent($("#rewriteBody").val())+'&path='+filename+'&encoding=utf-8';
function setRewrite(filename,data){
var data = 'data='+data+'&path='+filename+'&encoding=utf-8';
var loadT = layer.msg(lan.site.saving_txt,{icon:16,time:0,shade: [0.3, '#000']});
$.post('/site/set_rewrite',data,function(rdata){
layer.close(loadT);

Some files were not shown because too many files have changed in this diff Show More