From ca61f70d3730f79e308e4bc3a78410806ac33c68 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 21 Dec 2024 20:27:51 +0800 Subject: [PATCH] =?UTF-8?q?gorse=E4=BE=BF=E6=8D=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gorse/index.html | 1 + plugins/gorse/index.py | 30 ++++++++++++++++++++++++++++++ plugins/gorse/js/gorse.js | 32 +++++++++++++++++++++++++++++++- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/plugins/gorse/index.html b/plugins/gorse/index.html index 80316d979d..930ccfd720 100755 --- a/plugins/gorse/index.html +++ b/plugins/gorse/index.html @@ -14,6 +14,7 @@

服务

自启动

配置修改

+

常用功能

运行日志

相关说明

diff --git a/plugins/gorse/index.py b/plugins/gorse/index.py index fa443ece73..1276f6c109 100755 --- a/plugins/gorse/index.py +++ b/plugins/gorse/index.py @@ -304,6 +304,34 @@ def initdUinstall(): def runLog(): return getServerDir() + '/logs.pl' +def getGorseInfo(): + conf_file = getConf() + content = mw.readFile(conf_file) + + rdata = {} + + rep = r'dashboard_user_name\s*=\s*"(.*)"' + tmp = re.search(rep, content) + tmp = re.search(rep, content, re.M) + if tmp: + rdata['dashboard_user_name'] = tmp.groups()[0] + + + rep = r'dashboard_password\s*=\s*"(.*)"' + tmp = re.search(rep, content) + tmp = re.search(rep, content, re.M) + if tmp: + rdata['dashboard_password'] = tmp.groups()[0] + + rep = r'http_port\s*=\s*(.*)' + tmp = re.search(rep, content) + tmp = re.search(rep, content, re.M) + if tmp: + rdata['http_port'] = tmp.groups()[0] + + rdata['ip'] = mw.getHostAddr() + return mw.returnJson(True,'ok', rdata) + def installPreInspection(): redis_path = mw.getServerDir() + "/redis" if not os.path.exists(redis_path): @@ -347,5 +375,7 @@ def installPreInspection(): print(configTpl()) elif func == 'read_config_tpl': print(readConfigTpl()) + elif func == 'info': + print(getGorseInfo()) else: print('error') diff --git a/plugins/gorse/js/gorse.js b/plugins/gorse/js/gorse.js index a724387680..51dd8fb55b 100755 --- a/plugins/gorse/js/gorse.js +++ b/plugins/gorse/js/gorse.js @@ -54,8 +54,38 @@ function gorsePostCallbak(method, version, args,callback){ } -function gorseReadme(){ +function gorseCommonFunc(){ + gorsePost('info', '', {}, function(rdata){ + var rdata = $.parseJSON(rdata.data); + var info = rdata['data']; + var con = '

\ + 用户名\ + \ +

'; + + con += '

\ + 密码\ + \ +

'; + con += '

\ + 端口\ + \ +

'; + + con += '

\ + \ +

'; + $(".soft-man-con").html(con); + $('#open_url').click(function(){ + var url = 'http://' + info.ip + ':' + info.http_port; + window.open(url); + copyText(url); + }); + }); +} + +function gorseReadme(){ var readme = '