Commit 3527332d authored by nanahira's avatar nanahira

js

parent 6034c32a
...@@ -2351,7 +2351,7 @@ ...@@ -2351,7 +2351,7 @@
return callback + "( " + text + " );"; return callback + "( " + text + " );";
}; };
requestListener = function(request, response) { requestListener = function(request, response) {
var archive_args, archive_name, archive_process, duellog, error, filename, getpath, j, k, len, len1, parseQueryString, pass_validated, player, ref, replay_file, room, roomsjson, u; var archive_args, archive_name, archive_process, duellog, error, filename, getpath, j, k, len, len1, parseQueryString, pass_validated, player, ref, replay, room, roomsjson, u;
parseQueryString = true; parseQueryString = true;
u = url.parse(request.url, parseQueryString); u = url.parse(request.url, parseQueryString);
pass_validated = u.query.pass === settings.modules.http.password; pass_validated = u.query.pass === settings.modules.http.password;
...@@ -2429,11 +2429,14 @@ ...@@ -2429,11 +2429,14 @@
archive_process = spawn(settings.modules.tournament_mode.replay_archive_tool, archive_args, { archive_process = spawn(settings.modules.tournament_mode.replay_archive_tool, archive_args, {
cwd: settings.modules.tournament_mode.replay_path cwd: settings.modules.tournament_mode.replay_path
}); });
archive_process.on('error', (err) => { archive_process.on('error', (function(_this) {
return function(err) {
response.writeHead(403); response.writeHead(403);
response.end("Failed packing replays. " + err); response.end("Failed packing replays. " + err);
}); };
archive_process.on('exit', (code) => { })(this));
archive_process.on('exit', (function(_this) {
return function(code) {
return fs.readFile(settings.modules.tournament_mode.replay_path + archive_name, function(error, buffer) { return fs.readFile(settings.modules.tournament_mode.replay_path + archive_name, function(error, buffer) {
if (error) { if (error) {
response.writeHead(403); response.writeHead(403);
...@@ -2446,15 +2449,20 @@ ...@@ -2446,15 +2449,20 @@
response.end(buffer); response.end(buffer);
} }
}); });
}); };
})(this));
archive_process.stdout.setEncoding('utf8'); archive_process.stdout.setEncoding('utf8');
archive_process.stdout.on('data', function(data) { archive_process.stdout.on('data', (function(_this) {
return function(data) {
return log.info("archive process: " + data); return log.info("archive process: " + data);
}); };
})(this));
archive_process.stderr.setEncoding('utf8'); archive_process.stderr.setEncoding('utf8');
archive_process.stderr.on('data', function(data) { archive_process.stderr.on('data', (function(_this) {
return function(data) {
return log.warn("archive error: " + data); return log.warn("archive error: " + data);
}); };
})(this));
} catch (error1) { } catch (error1) {
error = error1; error = error1;
response.writeHead(403); response.writeHead(403);
......
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