Commit 7c75c56c authored by nanahira's avatar nanahira

basic plugin load

parent 1f8ab225
...@@ -159,7 +159,7 @@ catch ...@@ -159,7 +159,7 @@ catch
config = {} config = {}
settings = global.settings = merge(default_config, config, { arrayMerge: (destination, source) -> source }) settings = global.settings = merge(default_config, config, { arrayMerge: (destination, source) -> source })
auth = require './ygopro-auth.js' auth = global.auth = require './ygopro-auth.js'
#import old configs #import old configs
imported = false imported = false
...@@ -299,8 +299,8 @@ if settings.modules.heartbeat_detection.enabled ...@@ -299,8 +299,8 @@ if settings.modules.heartbeat_detection.enabled
long_resolve_cards = loadJSON('./data/long_resolve_cards.json') long_resolve_cards = loadJSON('./data/long_resolve_cards.json')
# 组件 # 组件
ygopro = require './ygopro.js' ygopro = global.ygopro = require './ygopro.js'
roomlist = require './roomlist.js' if settings.modules.http.websocket_roomlist roomlist = global.roomlist = require './roomlist.js' if settings.modules.http.websocket_roomlist
if settings.modules.i18n.auto_pick if settings.modules.i18n.auto_pick
geoip = require('geoip-country-lite') geoip = require('geoip-country-lite')
...@@ -3709,3 +3709,11 @@ if settings.modules.http ...@@ -3709,3 +3709,11 @@ if settings.modules.http
if settings.modules.http.websocket_roomlist and roomlist if settings.modules.http.websocket_roomlist and roomlist
roomlist.init https_server, ROOM_all roomlist.init https_server, ROOM_all
https_server.listen settings.modules.http.ssl.port https_server.listen settings.modules.http.ssl.port
if not fs.existsSync('./plugins')
fs.mkdirSync('./plugins')
plugin_list = fs.readdirSync("./plugins")
for plugin_filename in plugin_list
plugin_path = "./plugins/" + plugin_filename
require(plugin_path)
// Generated by CoffeeScript 1.12.7 // Generated by CoffeeScript 1.12.7
(function() { (function() {
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, dns, 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, real_windbot_server_ip, 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; 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, dns, 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, len2, lflists, list, loadJSON, load_dialogues, load_tips, log, long_resolve_cards, m, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, plugin_filename, plugin_list, plugin_path, real_windbot_server_ip, 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;
net = require('net'); net = require('net');
...@@ -166,7 +166,7 @@ ...@@ -166,7 +166,7 @@
} }
}); });
auth = require('./ygopro-auth.js'); auth = global.auth = require('./ygopro-auth.js');
imported = false; imported = false;
...@@ -350,10 +350,10 @@ ...@@ -350,10 +350,10 @@
long_resolve_cards = loadJSON('./data/long_resolve_cards.json'); long_resolve_cards = loadJSON('./data/long_resolve_cards.json');
} }
ygopro = require('./ygopro.js'); ygopro = global.ygopro = require('./ygopro.js');
if (settings.modules.http.websocket_roomlist) { if (settings.modules.http.websocket_roomlist) {
roomlist = require('./roomlist.js'); roomlist = global.roomlist = require('./roomlist.js');
} }
if (settings.modules.i18n.auto_pick) { if (settings.modules.i18n.auto_pick) {
...@@ -4773,4 +4773,16 @@ ...@@ -4773,4 +4773,16 @@
} }
} }
if (!fs.existsSync('./plugins')) {
fs.mkdirSync('./plugins');
}
plugin_list = fs.readdirSync("./plugins");
for (m = 0, len2 = plugin_list.length; m < len2; m++) {
plugin_filename = plugin_list[m];
plugin_path = "./plugins/" + plugin_filename;
require(plugin_path);
}
}).call(this); }).call(this);
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