aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlookshe <github@lookshe.org>2016-01-13 10:30:46 +0100
committerlookshe <github@lookshe.org>2016-01-13 10:52:45 +0100
commit546781317494c225b9446bacd368f618917fdf52 (patch)
tree9ec1844690cc6e231b4f2c952cdf367a9ae46480
parentc6da13b6320e3bb20f57a24ccb336de2684dd658 (diff)
read url and server_key from configuration
-rw-r--r--prosody-module/mod_http_upload_external/mod_http_upload_external.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/prosody-module/mod_http_upload_external/mod_http_upload_external.lua b/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
index af6d48a..768a956 100644
--- a/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
+++ b/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
@@ -10,8 +10,8 @@
--
-- configuration
-local external_url = "https://snippets.thedevstack.de/httpupload/index.php";
-local xmpp_server_key = "1323978hjkgh12";
+local external_url = module:get_option("http_upload_external_url");
+local xmpp_server_key = module:get_option("http_upload_external_server_key");
-- imports
local st = require"util.stanza";
@@ -36,6 +36,12 @@ module:hook("iq/host/"..xmlns_http_upload..":request", function (event)
origin.send(st.error_reply(stanza, "cancel", "not-authorized"));
return true;
end
+ -- check configuration
+ if not external_url or not xmpp_server_key then
+ module:log("debug", "missing configuration options: http_upload_external_url and/or http_upload_external_server_key");
+ origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
+ return true;
+ end
-- validate
local filename = request:get_child_text("filename");
if not filename then