Commit 3527332d authored by nanahira's avatar nanahira

js

parent 6034c32a
...@@ -1588,7 +1588,7 @@ ...@@ -1588,7 +1588,7 @@
} }
return false; return false;
}); });
ygopro.ctos_follow('HS_KICK', true, function(buffer, info, client, server) { ygopro.ctos_follow('HS_KICK', true, function(buffer, info, client, server) {
var j, len, player, ref, room; var j, len, player, ref, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
...@@ -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,32 +2429,40 @@ ...@@ -2429,32 +2429,40 @@
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) {
response.writeHead(403); return function(err) {
response.end("Failed packing replays. " + err); response.writeHead(403);
}); response.end("Failed packing replays. " + err);
archive_process.on('exit', (code) => { };
return fs.readFile(settings.modules.tournament_mode.replay_path + archive_name, function(error, buffer) { })(this));
if (error) { archive_process.on('exit', (function(_this) {
response.writeHead(403); return function(code) {
response.end("Failed sending replays. " + error); return fs.readFile(settings.modules.tournament_mode.replay_path + archive_name, function(error, buffer) {
} else { if (error) {
response.writeHead(200, { response.writeHead(403);
"Content-Type": "application/octet-stream", response.end("Failed sending replays. " + error);
"Content-Disposition": "attachment" } else {
}); response.writeHead(200, {
response.end(buffer); "Content-Type": "application/octet-stream",
} "Content-Disposition": "attachment"
}); });
}); 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 log.info("archive process: " + data); return function(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 log.warn("archive error: " + data); return function(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