Commit 3a7e6938 authored by mercury233's avatar mercury233

fix

parent 2f174b28
...@@ -163,6 +163,7 @@ if settings.modules.tournament_mode.enabled ...@@ -163,6 +163,7 @@ if settings.modules.tournament_mode.enabled
duel_log.file = 'duel_log.' + moment().format('YYYY-MM-DD HH-mm-ss') + '.json' duel_log.file = 'duel_log.' + moment().format('YYYY-MM-DD HH-mm-ss') + '.json'
duel_log.duel_log = [] duel_log.duel_log = []
setting_save(duel_log) setting_save(duel_log)
return
clearlog() clearlog()
# 组件 # 组件
...@@ -215,6 +216,8 @@ get_memory_usage = ()-> ...@@ -215,6 +216,8 @@ get_memory_usage = ()->
actualFree = free + buffers + cached actualFree = free + buffers + cached
percentUsed = parseFloat(((1 - (actualFree / total)) * 100).toFixed(2)) percentUsed = parseFloat(((1 - (actualFree / total)) * 100).toFixed(2))
memory_usage = percentUsed memory_usage = percentUsed
return
return
get_memory_usage() get_memory_usage()
setInterval(get_memory_usage, 3000) setInterval(get_memory_usage, 3000)
...@@ -2083,6 +2086,7 @@ if settings.modules.http ...@@ -2083,6 +2086,7 @@ if settings.modules.http
else else
response.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Disposition": "attachment" }) response.writeHead(200, { "Content-Type": "application/octet-stream", "Content-Disposition": "attachment" })
response.end(buffer) response.end(buffer)
return
) )
else if u.pathname == '/api/message' else if u.pathname == '/api/message'
......
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
duel_log = {}; duel_log = {};
duel_log.file = 'duel_log.' + moment().format('YYYY-MM-DD HH-mm-ss') + '.json'; duel_log.file = 'duel_log.' + moment().format('YYYY-MM-DD HH-mm-ss') + '.json';
duel_log.duel_log = []; duel_log.duel_log = [];
return setting_save(duel_log); setting_save(duel_log);
}; };
clearlog(); clearlog();
} }
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
get_memory_usage = function() { get_memory_usage = function() {
var prc_free; var prc_free;
prc_free = exec("free"); prc_free = exec("free");
return prc_free.stdout.on('data', function(data) { prc_free.stdout.on('data', function(data) {
var actualFree, buffers, cached, free, line, lines, new_free, percentUsed, total; var actualFree, buffers, cached, free, line, lines, new_free, percentUsed, total;
lines = data.toString().split(/\n/g); lines = data.toString().split(/\n/g);
line = lines[0].split(/\s+/); line = lines[0].split(/\s+/);
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
actualFree = free + buffers + cached; actualFree = free + buffers + cached;
} }
percentUsed = parseFloat(((1 - (actualFree / total)) * 100).toFixed(2)); percentUsed = parseFloat(((1 - (actualFree / total)) * 100).toFixed(2));
return memory_usage = percentUsed; memory_usage = percentUsed;
}); });
}; };
...@@ -2640,13 +2640,13 @@ ...@@ -2640,13 +2640,13 @@
fs.readFile(settings.modules.tournament_mode.replay_path + filename, function(error, buffer) { fs.readFile(settings.modules.tournament_mode.replay_path + filename, function(error, buffer) {
if (error) { if (error) {
response.writeHead(404); response.writeHead(404);
return response.end("未找到文件 " + filename); response.end("未找到文件 " + filename);
} else { } else {
response.writeHead(200, { response.writeHead(200, {
"Content-Type": "application/octet-stream", "Content-Type": "application/octet-stream",
"Content-Disposition": "attachment" "Content-Disposition": "attachment"
}); });
return response.end(buffer); response.end(buffer);
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment