Commit 1c96596f authored by nanahira's avatar nanahira

Merge branch 'mc'

parents 876fc6bd b99743ad
...@@ -553,14 +553,14 @@ ...@@ -553,14 +553,14 @@
"integrity": "sha1-2qBoIGKCVCwIgojpdcKXwa53tpA=" "integrity": "sha1-2qBoIGKCVCwIgojpdcKXwa53tpA="
}, },
"load-json-file": { "load-json-file": {
"version": "6.0.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-6.0.0.tgz", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-6.1.0.tgz",
"integrity": "sha512-3/eL1P4bnmFo3iQUGcDs9V+7IKUmwq//lcgRcduRsCf3AUe7NYFHkRIUUjbzOj3jpr0HIWfkZYUKrCdwLcMU/w==", "integrity": "sha512-Oxzrf5BMvKyMOwuAXwDUdTO1kBo646k1rc644wfr2xZWqXHKj70DHtLeU1COKFqPX0aUGflj2mOUMTJZfSMMyg==",
"requires": { "requires": {
"graceful-fs": "^4.1.15", "graceful-fs": "^4.1.15",
"parse-json": "^4.0.0", "parse-json": "^4.0.0",
"strip-bom": "^3.0.0", "strip-bom": "^4.0.0",
"type-fest": "^0.4.1" "type-fest": "^0.5.2"
}, },
"dependencies": { "dependencies": {
"graceful-fs": { "graceful-fs": {
...@@ -1142,9 +1142,9 @@ ...@@ -1142,9 +1142,9 @@
} }
}, },
"strip-bom": { "strip-bom": {
"version": "3.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w=="
}, },
"strip-json-comments": { "strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
...@@ -1205,9 +1205,9 @@ ...@@ -1205,9 +1205,9 @@
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
}, },
"type-fest": { "type-fest": {
"version": "0.4.1", "version": "0.5.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.4.1.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.5.2.tgz",
"integrity": "sha512-IwzA/LSfD2vC1/YDYMv/zHP4rDF1usCwllsDpbolT3D4fUepIO7f9K70jjmUewU/LmGUKJcwcVtDCpnKk4BPMw==" "integrity": "sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw=="
}, },
"ultron": { "ultron": {
"version": "1.0.2", "version": "1.0.2",
......
...@@ -3845,6 +3845,7 @@ setInterval ()-> ...@@ -3845,6 +3845,7 @@ setInterval ()->
# spawn windbot # spawn windbot
windbot_looplimit = 0 windbot_looplimit = 0
windbot_process = null
spawn_windbot = () -> spawn_windbot = () ->
if /^win/.test(process.platform) if /^win/.test(process.platform)
...@@ -3858,13 +3859,13 @@ spawn_windbot = () -> ...@@ -3858,13 +3859,13 @@ spawn_windbot = () ->
windbot_process = spawn windbot_bin, windbot_parameters, {cwd: 'windbot'} windbot_process = spawn windbot_bin, windbot_parameters, {cwd: 'windbot'}
windbot_process.on 'error', (err)-> windbot_process.on 'error', (err)->
log.warn 'WindBot ERROR', err log.warn 'WindBot ERROR', err
if windbot_looplimit < 1000 if windbot_looplimit < 1000 and !rebooted
windbot_looplimit++ windbot_looplimit++
spawn_windbot() spawn_windbot()
return return
windbot_process.on 'exit', (code)-> windbot_process.on 'exit', (code)->
log.warn 'WindBot EXIT', code log.warn 'WindBot EXIT', code
if windbot_looplimit < 1000 if windbot_looplimit < 1000 and !rebooted
windbot_looplimit++ windbot_looplimit++
spawn_windbot() spawn_windbot()
return return
...@@ -3881,6 +3882,7 @@ spawn_windbot = () -> ...@@ -3881,6 +3882,7 @@ spawn_windbot = () ->
if settings.modules.windbot.enabled and settings.modules.windbot.spawn if settings.modules.windbot.enabled and settings.modules.windbot.spawn
spawn_windbot() spawn_windbot()
rebooted = false
#http #http
if settings.modules.http if settings.modules.http
...@@ -4155,6 +4157,26 @@ if settings.modules.http ...@@ -4155,6 +4157,26 @@ if settings.modules.http
else else
response.end(addCallback(u.query.callback, "['room not found', '" + u.query.deathcancel + "']")) response.end(addCallback(u.query.callback, "['room not found', '" + u.query.deathcancel + "']"))
else if u.query.reboot
if !auth.auth(u.query.username, u.query.pass, "stop", "reboot")
response.writeHead(200)
response.end(addCallback(u.query.callback, "['密码错误', 0]"))
return
for room in ROOM_all when room
if room.started
room.scores[room.dueling_players[0].name_vpass] = 0
room.scores[room.dueling_players[1].name_vpass] = 0
room.kicked = true
room.send_replays()
room.process.kill()
room.delete()
rebooted = true
if windbot_process
windbot_process.kill()
response.writeHead(200)
response.end(addCallback(u.query.callback, "['reboot ok', '" + u.query.reboot + "']"))
throw "rebooted"
else if u.query.generatekey and settings.modules.vip.enabled else if u.query.generatekey and settings.modules.vip.enabled
if !auth.auth(u.query.username, u.query.pass, "vip", "generate_keys") if !auth.auth(u.query.username, u.query.pass, "vip", "generate_keys")
response.writeHead(200) response.writeHead(200)
......
// Generated by CoffeeScript 1.12.7 // Generated by CoffeeScript 1.12.7
(function() { (function() {
<<<<<<< HEAD
var CLIENT_check_vip, CLIENT_get_absolute_pos, CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_get_partner, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_replays, CLIENT_send_vip_status, CLIENT_use_cdkey, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_player_flee, ROOM_player_get_score, ROOM_player_lose, ROOM_player_win, ROOM_players_banned, ROOM_players_oppentlist, ROOM_players_scores, ROOM_unwelcome, ROOM_validate, Room, SERVER_clear_disconnect, SOCKET_flush_data, VIP_generate_cdkeys, _, addCallback, auth, badwords, ban_user, bunyan, challonge, challonge_cache, challonge_module_name, challonge_queue_callbacks, chat_color, concat_name, config, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_callback, get_memory_usage, http, http_server, https, https_server, import_datas, imported, is_requesting, j, k, l, len1, len2, lflists, list, loadJSON, load_dialogues, load_dialogues_custom, load_tips, load_tips_zh, load_words, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, oldwords, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, ref2, refresh_challonge_cache, release_disconnect, replace_buffer, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, spawn_windbot, sqlite3, tips, url, users_cache, v, vip_info, wait_room_start, wait_room_start_arena, windbot_looplimit, windbots, words, ygopro, zlib; var CLIENT_check_vip, CLIENT_get_absolute_pos, CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_get_partner, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_replays, CLIENT_send_vip_status, CLIENT_use_cdkey, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_player_flee, ROOM_player_get_score, ROOM_player_lose, ROOM_player_win, ROOM_players_banned, ROOM_players_oppentlist, ROOM_players_scores, ROOM_unwelcome, ROOM_validate, Room, SERVER_clear_disconnect, SOCKET_flush_data, VIP_generate_cdkeys, _, addCallback, auth, badwords, ban_user, bunyan, challonge, challonge_cache, challonge_module_name, challonge_queue_callbacks, chat_color, concat_name, config, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_callback, get_memory_usage, http, http_server, https, https_server, import_datas, imported, is_requesting, j, k, l, len1, len2, lflists, list, loadJSON, load_dialogues, load_dialogues_custom, load_tips, load_tips_zh, load_words, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, oldwords, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, ref2, refresh_challonge_cache, release_disconnect, replace_buffer, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, spawn_windbot, sqlite3, tips, url, users_cache, v, vip_info, wait_room_start, wait_room_start_arena, windbot_looplimit, windbots, words, ygopro, zlib;
=======
var CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_replays, Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_player_flee, ROOM_player_get_score, ROOM_player_lose, ROOM_player_win, ROOM_players_banned, ROOM_players_oppentlist, ROOM_players_scores, ROOM_unwelcome, ROOM_validate, Room, SERVER_clear_disconnect, SOCKET_flush_data, _, addCallback, auth, badwords, ban_user, bunyan, challonge, challonge_cache, challonge_module_name, challonge_queue_callbacks, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, disconnect_list, duel_log, e, exec, execFile, fs, geoip, get_callback, get_memory_usage, http, http_server, https, https_server, import_datas, imported, is_requesting, j, l, len, len1, lflists, list, loadJSON, load_dialogues, load_tips, log, long_resolve_cards, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, rebooted, redis, redisdb, ref, ref1, refresh_challonge_cache, release_disconnect, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, spawn_windbot, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_looplimit, windbot_process, windbots, ygopro, zlib;
>>>>>>> mc
net = require('net'); net = require('net');
...@@ -5004,8 +5008,10 @@ ...@@ -5004,8 +5008,10 @@
windbot_looplimit = 0; windbot_looplimit = 0;
windbot_process = null;
spawn_windbot = function() { spawn_windbot = function() {
var windbot_bin, windbot_parameters, windbot_process; var windbot_bin, windbot_parameters;
if (/^win/.test(process.platform)) { if (/^win/.test(process.platform)) {
windbot_bin = 'WindBot.exe'; windbot_bin = 'WindBot.exe';
windbot_parameters = []; windbot_parameters = [];
...@@ -5020,14 +5026,14 @@ ...@@ -5020,14 +5026,14 @@
}); });
windbot_process.on('error', function(err) { windbot_process.on('error', function(err) {
log.warn('WindBot ERROR', err); log.warn('WindBot ERROR', err);
if (windbot_looplimit < 1000) { if (windbot_looplimit < 1000 && !rebooted) {
windbot_looplimit++; windbot_looplimit++;
spawn_windbot(); spawn_windbot();
} }
}); });
windbot_process.on('exit', function(code) { windbot_process.on('exit', function(code) {
log.warn('WindBot EXIT', code); log.warn('WindBot EXIT', code);
if (windbot_looplimit < 1000) { if (windbot_looplimit < 1000 && !rebooted) {
windbot_looplimit++; windbot_looplimit++;
spawn_windbot(); spawn_windbot();
} }
...@@ -5046,6 +5052,8 @@ ...@@ -5046,6 +5052,8 @@
spawn_windbot(); spawn_windbot();
} }
rebooted = false;
if (settings.modules.http) { if (settings.modules.http) {
addCallback = function(callback, text) { addCallback = function(callback, text) {
if (!callback) { if (!callback) {
...@@ -5054,7 +5062,11 @@ ...@@ -5054,7 +5062,11 @@
return callback + "( " + text + " );"; return callback + "( " + text + " );";
}; };
requestListener = function(request, response) { requestListener = function(request, response) {
<<<<<<< HEAD
var archive_args, archive_name, archive_process, check, death_room_found, duellog, error, filename, getpath, key, kick_room_found, len3, len4, len5, len6, len7, len8, m, n, o, p, parseQueryString, pass_validated, player, q, r, ref3, ref4, replay, ret_keys, room, roomsjson, u; var archive_args, archive_name, archive_process, check, death_room_found, duellog, error, filename, getpath, key, kick_room_found, len3, len4, len5, len6, len7, len8, m, n, o, p, parseQueryString, pass_validated, player, q, r, ref3, ref4, replay, ret_keys, room, roomsjson, u;
=======
var archive_args, archive_name, archive_process, check, death_room_found, duellog, error, filename, getpath, kick_room_found, len2, len3, len4, len5, len6, len7, m, n, o, p, parseQueryString, pass_validated, player, q, r, ref2, replay, room, roomsjson, u;
>>>>>>> mc
parseQueryString = true; parseQueryString = true;
u = url.parse(request.url, parseQueryString); u = url.parse(request.url, parseQueryString);
if (u.pathname === '/api/getrooms') { if (u.pathname === '/api/getrooms') {
...@@ -5390,15 +5402,44 @@ ...@@ -5390,15 +5402,44 @@
} else { } else {
response.end(addCallback(u.query.callback, "['room not found', '" + u.query.deathcancel + "']")); response.end(addCallback(u.query.callback, "['room not found', '" + u.query.deathcancel + "']"));
} }
<<<<<<< HEAD
} else if (u.query.generatekey && settings.modules.vip.enabled) { } else if (u.query.generatekey && settings.modules.vip.enabled) {
if (!auth.auth(u.query.username, u.query.pass, "vip", "generate_keys")) { if (!auth.auth(u.query.username, u.query.pass, "vip", "generate_keys")) {
=======
} else if (u.query.reboot) {
if (!auth.auth(u.query.username, u.query.pass, "stop", "reboot")) {
>>>>>>> mc
response.writeHead(200); response.writeHead(200);
response.end(addCallback(u.query.callback, "['密码错误', 0]")); response.end(addCallback(u.query.callback, "['密码错误', 0]"));
return; return;
} }
<<<<<<< HEAD
VIP_generate_cdkeys(u.query.generatekey, settings.modules.vip.generate_count); VIP_generate_cdkeys(u.query.generatekey, settings.modules.vip.generate_count);
response.writeHead(200); response.writeHead(200);
response.end(addCallback(u.query.callback, "['Keys generated', '" + u.query.generatekey + "']")); response.end(addCallback(u.query.callback, "['Keys generated', '" + u.query.generatekey + "']"));
=======
for (r = 0, len7 = ROOM_all.length; r < len7; r++) {
room = ROOM_all[r];
if (!(room)) {
continue;
}
if (room.started) {
room.scores[room.dueling_players[0].name_vpass] = 0;
room.scores[room.dueling_players[1].name_vpass] = 0;
}
room.kicked = true;
room.send_replays();
room.process.kill();
room["delete"]();
}
rebooted = true;
if (windbot_process) {
windbot_process.kill();
}
response.writeHead(200);
response.end(addCallback(u.query.callback, "['reboot ok', '" + u.query.reboot + "']"));
throw "rebooted";
>>>>>>> mc
} else { } else {
response.writeHead(400); response.writeHead(400);
response.end(); response.end();
......
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