mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 04:29:25 +08:00
网站统计记录POST请求原文优化
This commit is contained in:
@@ -207,7 +207,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
resetPluginWinWidth(900);
|
||||
resetPluginWinWidth(950);
|
||||
$.getScript( "/static/js/echarts.min.js", function(){
|
||||
console.log("echarts load done");
|
||||
});
|
||||
|
||||
@@ -95,6 +95,22 @@ def loadConfigFile():
|
||||
content = mw.readFile(conf_tpl)
|
||||
content = json.loads(content)
|
||||
|
||||
dst_conf_json = getServerDir() + "/lua/config.json"
|
||||
if not os.path.exists(dst_conf_json):
|
||||
mw.writeFile(dst_conf_json, json.dumps(content))
|
||||
|
||||
dst_conf_lua = getServerDir() + "/lua/webstats_config.lua"
|
||||
if not os.path.exists(dst_conf_lua):
|
||||
listToLuaFile(dst_conf_lua, content)
|
||||
|
||||
|
||||
def loadConfigFileReload():
|
||||
lua_dir = getServerDir() + "/lua"
|
||||
conf_tpl = getPluginDir() + "/conf/config.json"
|
||||
|
||||
content = mw.readFile(conf_tpl)
|
||||
content = json.loads(content)
|
||||
|
||||
dst_conf_json = getServerDir() + "/lua/config.json"
|
||||
mw.writeFile(dst_conf_json, json.dumps(content))
|
||||
|
||||
@@ -262,6 +278,7 @@ def restart():
|
||||
def reload():
|
||||
initDreplace()
|
||||
|
||||
loadConfigFileReload()
|
||||
loadDebugLogFile()
|
||||
|
||||
mw.opWeb("reload")
|
||||
|
||||
@@ -2232,7 +2232,12 @@ function wsTableLogRequest(page){
|
||||
list += '<td>' + toSecond(data[i]['request_time']) +'</td>';
|
||||
list += '<td><span class="overflow_hide" style="width:130px;">' + data[i]['uri'] +'</span></td>';
|
||||
list += '<td>'+spider_tip+'<span class="overflow_hide" style="width:60px;">' + data[i]['status_code']+'/' + data[i]['method'] +'</span></td>';
|
||||
list += '<td><a data-id="'+i+'" href="javascript:;" class="btlink details" title="详情">详情</a></td>';
|
||||
|
||||
var http_data = ' ';
|
||||
if (data[i]['request_headers']!=''){
|
||||
http_data = '<a data-id="'+i+'" href="javascript:;" class="btlink http_data" title="HTTP">HTTP</a> | ';
|
||||
}
|
||||
list += '<td><span>'+http_data+'<a data-id="'+i+'" href="javascript:;" class="btlink details" title="详情">详情</a></span></td>';
|
||||
list += '</tr>';
|
||||
}
|
||||
} else{
|
||||
@@ -2277,19 +2282,52 @@ function wsTableLogRequest(page){
|
||||
<div><b style="margin-left:10px">协议</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + res.protocol + '</div></div>\
|
||||
<div><b style="margin-left:10px">URL</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div ></div>').text(res.uri).html() + '</div></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div></div>').text(res.uri).html() + '</div></div>\
|
||||
<div><b style="margin-left:10px">完整IP列表</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre" style="max-height: 66px;">' + $('<div ></div>').text(res.ip_list).html() + '</div></div>\
|
||||
<div><b style="margin-left:10px">来路</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div ></div>').text(res.referer == null ?'None':res.referer).html() + '</div></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div></div>').text(res.referer == null ?'None':res.referer).html() + '</div></div>\
|
||||
<div><b style="margin-left:10px">User-Agent</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div ></div>').text(res.user_agent).html() + '</div></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' + $('<div></div>').text(res.user_agent).html() + '</div></div>\
|
||||
<div><b style="margin-left:10px">处理耗时</b></div>\
|
||||
<div class="lib-con mt10"><div class="divpre">' +res.request_time + ' ms</div></div>\
|
||||
</div>',
|
||||
});
|
||||
});
|
||||
|
||||
$(".tablescroll .http_data").click(function(){
|
||||
var index = $(this).attr('data-id');
|
||||
var res = data[index];
|
||||
var request_headers = res.request_headers;
|
||||
var req_data = $.parseJSON(request_headers);
|
||||
|
||||
var req_data_html = res.method +' ' + res.uri + '<br/>';
|
||||
for (var d in req_data) {
|
||||
|
||||
if (d == 'payload'){
|
||||
req_data_html += '<b style="color:red;">'+d +"</b>:"+req_data[d]+"<br/>";
|
||||
} else{
|
||||
req_data_html += d+":"+req_data[d]+"<br/>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: "【"+res.domain + "】HTTP详情",
|
||||
area: ['600px','375px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15 lib-box">\
|
||||
<div class="lib-con mt10"><div class="divpre" style="max-height:250px;white-space: break-spaces;">' + req_data_html + '</div></div>\
|
||||
<ul class="help-info-text c7 mtb15">\
|
||||
<li style="list-style: none;">payload: POST请求中客户端提交的参数。</li>\
|
||||
</ul>\
|
||||
</div>',
|
||||
});
|
||||
});
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,6 +76,10 @@ function _M.getTotalKey(self)
|
||||
return self.total_key
|
||||
end
|
||||
|
||||
function _M.to_json(self, msg)
|
||||
return json.encode(msg)
|
||||
end
|
||||
|
||||
function _M.setConfData( self, config, site_config )
|
||||
self.config = config
|
||||
self.site_config = site_config
|
||||
|
||||
@@ -373,8 +373,7 @@ log_by_lua_block {
|
||||
local client_stat_fields = {}
|
||||
|
||||
if not excluded then
|
||||
|
||||
if status_code == 500 or (method=="POST" and config["record_post_args"] == true) or (status_code==403 and config["record_get_403_args"] == true) then
|
||||
if status_code == 500 or (method=="POST" and config['global']["record_post_args"] == true) or (status_code==403 and config['global']["record_get_403_args"] == true) then
|
||||
local data = ""
|
||||
local ok, err = pcall(function() data = C:get_http_origin() end)
|
||||
if ok and not err then
|
||||
|
||||
Reference in New Issue
Block a user