Commit 9ea82a4b authored by nanahira's avatar nanahira

support all options for Challonge

parent b6d5fbe5
......@@ -122,7 +122,9 @@
"post_detailed_score": true,
"post_score_midduel": true,
"cache_ttl": 60000,
"api_key": "123",
"options": {
"apiKey": "123"
},
"tournament_id": "456",
"use_custom_module": false
},
......
......@@ -215,6 +215,11 @@ if settings.hostinfo.enable_priority or settings.hostinfo.enable_priority == fal
settings.hostinfo.duel_rule = 4
delete settings.hostinfo.enable_priority
imported = true
#import the old Challonge api key option
if settings.modules.challonge.api_key
settings.modules.challonge.options.apiKey = settings.modules.challonge.api_key
delete settings.modules.challonge.api_key
imported = true
#finish
if imported
setting_save(settings)
......@@ -341,9 +346,7 @@ if settings.modules.challonge.enabled
challonge_module_name = 'challonge'
if settings.modules.challonge.use_custom_module
challonge_module_name = settings.modules.challonge.use_custom_module
challonge = require(challonge_module_name).createClient({
apiKey: settings.modules.challonge.api_key
})
challonge = require(challonge_module_name).createClient(settings.modules.challonge.options)
if settings.modules.challonge.cache_ttl
challonge_cache = []
challonge_queue_callbacks = [[], []]
......
......@@ -233,6 +233,12 @@
imported = true;
}
if (settings.modules.challonge.api_key) {
settings.modules.challonge.options.apiKey = settings.modules.challonge.api_key;
delete settings.modules.challonge.api_key;
imported = true;
}
if (imported) {
setting_save(settings);
}
......@@ -401,9 +407,7 @@
if (settings.modules.challonge.use_custom_module) {
challonge_module_name = settings.modules.challonge.use_custom_module;
}
challonge = require(challonge_module_name).createClient({
apiKey: settings.modules.challonge.api_key
});
challonge = require(challonge_module_name).createClient(settings.modules.challonge.options);
if (settings.modules.challonge.cache_ttl) {
challonge_cache = [];
}
......
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