Mercurial > prosody-modules
comparison mod_candy/mod_candy.lua @ 2454:51cf82d36a8a
mod_candy: Add support for enabling Candy debug mode from Prosodys config
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 20 Jan 2017 01:30:34 +0100 |
| parents | f36a6dcc05ef |
| children |
comparison
equal
deleted
inserted
replaced
| 2453:f36a6dcc05ef | 2454:51cf82d36a8a |
|---|---|
| 6 local is_module_loaded = require "core.modulemanager".is_loaded; | 6 local is_module_loaded = require "core.modulemanager".is_loaded; |
| 7 | 7 |
| 8 local serve = module:depends"http_files".serve; | 8 local serve = module:depends"http_files".serve; |
| 9 | 9 |
| 10 local candy_rooms = module:get_option_array("candy_rooms"); | 10 local candy_rooms = module:get_option_array("candy_rooms"); |
| 11 local candy_debug = module:get_option_boolean("candy_debug", false); | |
| 11 | 12 |
| 12 local function get_autojoin() | 13 local function get_autojoin() |
| 13 if candy_rooms then | 14 if candy_rooms then |
| 14 -- Configured room list, if any | 15 -- Configured room list, if any |
| 15 return candy_rooms; | 16 return candy_rooms; |
| 45 :format(json_encode({ | 46 :format(json_encode({ |
| 46 connect_path = get_connect_path(); | 47 connect_path = get_connect_path(); |
| 47 autojoin = get_autojoin(); | 48 autojoin = get_autojoin(); |
| 48 version = prosody.version; | 49 version = prosody.version; |
| 49 host = module:get_host(); | 50 host = module:get_host(); |
| 51 debug = candy_debug; | |
| 50 anonymous = module:get_option_string("authentication") == "anonymous"; | 52 anonymous = module:get_option_string("authentication") == "anonymous"; |
| 51 })); | 53 })); |
| 52 end; | 54 end; |
| 53 ["GET /*"] = serve(module:get_directory().."/www_files"); | 55 ["GET /*"] = serve(module:get_directory().."/www_files"); |
| 54 | 56 |
