diff --git a/01.web/src/views/advance/index.vue b/01.web/src/views/advance/index.vue index 05abe01..7979272 100644 --- a/01.web/src/views/advance/index.vue +++ b/01.web/src/views/advance/index.vue @@ -168,7 +168,7 @@ -
+ @@ -330,20 +330,14 @@ - - - - - - - - - - - + - + @@ -351,33 +345,12 @@ - - - - - - - -
- - 1、本系统使用token进行鉴权和登录状态保持
- 2、密钥 + 算法 = token
- 3、密钥泄露会导致token被伪造从而登录本系统
- 4、定期重置密钥可以增加系统的安全性
- 5、重置密钥后所有管理系统在线用户会被下线
-
- - - - - - - +
- +
@@ -459,6 +432,11 @@ export default { */ currentAdvanceTab: "1", + /** + * + */ + listPush: [], + /** * 加载 */ @@ -476,6 +454,8 @@ export default { loadingSendTest: false, //保存邮件配置信息 loadingEditEmail: false, + //保存推送配置信息 + loadingEditPush:false, /** * subversion信息 @@ -537,6 +517,7 @@ export default { this.GetDetail(); this.GetConfig(); this.GetEmail(); + this.GetPush(); }, methods: { /** @@ -729,6 +710,54 @@ export default { that.$Message.error("出错了 请联系管理员!"); }); }, + /** + * 获取消息推送配置 + */ + GetPush() { + var that = this; + var data = {}; + that.$axios + .post("/api.php?c=Mail&a=GetPush&t=web", data) + .then(function (response) { + var result = response.data; + if (result.status == 1) { + that.listPush = result.data; + } else { + that.$Message.error(result.message); + } + }) + .catch(function (error) { + console.log(error); + that.$Message.error("出错了 请联系管理员!"); + }); + }, + /** + * 修改信息 + */ + EditPush() { + var that = this; + that.loadingEditPush = true; + var data = { + listPush: that.listPush, + }; + that.$axios + .post("/api.php?c=Mail&a=EditPush&t=web", data) + .then(function (response) { + that.loadingEditPush = false; + var result = response.data; + if (result.status == 1) { + that.$Message.success(result.message); + that.GetPush(); + } else { + that.$Message.error(result.message); + } + }) + .catch(function (error) { + that.loadingEditPush = false; + console.log(error); + that.$Message.error("出错了 请联系管理员!"); + }); + }, /** * 安装SVN */ diff --git a/01.web/src/views/repositoryInfo/index.vue b/01.web/src/views/repositoryInfo/index.vue index e68764c..34b0cf4 100644 --- a/01.web/src/views/repositoryInfo/index.vue +++ b/01.web/src/views/repositoryInfo/index.vue @@ -264,7 +264,10 @@ @click="DownloadRepBackup(row.fileName)" >下载 - diff --git a/02.php/app/controller/Mail.php b/02.php/app/controller/Mail.php index f2ba8ee..4d85c54 100644 --- a/02.php/app/controller/Mail.php +++ b/02.php/app/controller/Mail.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:05 * @LastEditors: witersen - * @LastEditTime: 2022-05-07 13:58:27 + * @LastEditTime: 2022-05-07 19:14:22 * @Description: QQ:1801168257 */ @@ -53,4 +53,22 @@ class Mail extends Base $result = $this->ServiceMail->SendTest(); json2($result); } + + /** + * 获取消息推送信息配置 + */ + public function GetPush() + { + $result = $this->ServiceMail->GetPush(); + json2($result); + } + + /** + * 修改推送选项 + */ + function EditPush() + { + $result = $this->ServiceMail->EditPush(); + json2($result); + } } diff --git a/02.php/app/service/Mail.php b/02.php/app/service/Mail.php index 26cd737..edeabe6 100644 --- a/02.php/app/service/Mail.php +++ b/02.php/app/service/Mail.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:05 * @LastEditors: witersen - * @LastEditTime: 2022-05-06 22:53:10 + * @LastEditTime: 2022-05-07 19:13:42 * @Description: QQ:1801168257 */ @@ -258,4 +258,75 @@ class Mail extends Base return message(200, $result === true ? 1 : 0, $result === true ? '发送成功' : $result); } + + /** + * 获取消息推送信息配置 + */ + public function GetPush() + { + $message_push = $this->database->get('options', [ + 'option_value' + ], [ + 'option_name' => 'message_push' + ]); + + $message_push_null = [ + [ + 'trigger' => 'Common/Login', + 'type' => 'mail', + 'note' => '用户登录', + 'enable' => false, + ], + [ + 'trigger' => 'Personal/EditAdminUserName', + 'type' => 'mail', + 'note' => '管理人员修改账户名', + 'enable' => false, + ], + [ + 'trigger' => 'Personal/EditAdminUserPass', + 'type' => 'mail', + 'note' => '管理人员修改密码', + 'enable' => false, + ], + [ + 'trigger' => 'Personal/EditSvnUserPass', + 'type' => 'mail', + 'note' => 'SVN用户修改密码', + 'enable' => false, + ], + ]; + + if ($message_push == null) { + $this->database->insert('options', [ + 'option_name' => 'message_push', + 'option_value' => serialize($message_push_null), + 'option_description' => '' + ]); + return message(200, 1, '成功', $message_push_null); + } + if ($message_push['option_value'] == '') { + $this->database->update('options', [ + 'option_value' => serialize($message_push_null), + ], [ + 'option_name' => 'message_push', + ]); + return message(200, 1, '成功', $message_push_null); + } + + return message(200, 1, '成功', unserialize($message_push['option_value'])); + } + + /** + * 修改推送选项 + */ + function EditPush() + { + $this->database->update('options', [ + 'option_value' => serialize($this->payload['listPush']) + ], [ + 'option_name' => 'message_push' + ]); + return message(); + } } diff --git a/02.php/app/service/Svnrep.php b/02.php/app/service/Svnrep.php index 1b96f42..264a8e2 100644 --- a/02.php/app/service/Svnrep.php +++ b/02.php/app/service/Svnrep.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:05 * @LastEditors: witersen - * @LastEditTime: 2022-05-07 14:21:35 + * @LastEditTime: 2022-05-07 17:03:32 * @Description: QQ:1801168257 */ @@ -1199,7 +1199,7 @@ class Svnrep extends Base public function DownloadRepBackup() { $filePath = $this->config_svn['backup_base_path'] . $this->payload['fileName']; - $this->DownloadRepBackup1($filePath, $this->payload['fileName']); + $this->DownloadRepBackup2($filePath, $this->payload['fileName']); } /** diff --git a/02.php/server/svnadmind.php b/02.php/server/svnadmind.php index 38455e0..cea9b7d 100644 --- a/02.php/server/svnadmind.php +++ b/02.php/server/svnadmind.php @@ -3,7 +3,7 @@ * @Author: witersen * @Date: 2022-04-24 23:37:06 * @LastEditors: witersen - * @LastEditTime: 2022-05-07 02:02:57 + * @LastEditTime: 2022-05-07 19:33:17 * @Description: QQ:1801168257 */ @@ -136,7 +136,7 @@ class Daemon //将标准错误重定向到文件 //使用状态码来标识错误信息 ob_start(); - FunShellExec($cmmand . " 2>$stderrFile", $resultCode); + passthru($cmmand . " 2>$stderrFile", $resultCode); $buffer = ob_get_contents(); ob_end_clean(); @@ -207,7 +207,7 @@ class Daemon /** * 检查需要的函数是否被禁用 */ - private function CheckDisabledFunction() + private function CheckDisabledFun() { $disabled_function = explode(',', ini_get('disable_functions')); $cli_needed_function = $this->config_daemon['CLI_NEEDED_FUNCTION']; @@ -221,6 +221,15 @@ class Daemon } } + /** + * 更新密钥 + */ + private function UpdateSign() + { + $signCon = sprintf(" '%s'];", uniqid()); + file_put_contents(BASE_PATH . '/../config/sign.php', $signCon); + } + /** * 以守护进程模式工作 */ @@ -276,8 +285,9 @@ class Daemon } else { $this->CheckSysType(); $this->CheckPhpVersion(); - $this->CheckDisabledFunction(); + $this->CheckDisabledFun(); if ($this->workMode == 'start') { + $this->UpdateSign(); $this->StartDaemon(); } else if ($this->workMode == 'console') { $this->StartConsole();