Commit 9ea82a4b authored by nanahira's avatar nanahira

support all options for Challonge

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