# HG changeset patch # User Trần H. Trung # Date 1690457592 -25200 # Node ID a74b07764d3f812d2f7527d2a8f9e476d710e538 # Parent 89b6d0e09b86517ab8d1f7a49444b6e7ebbb19b8 mod_invites_api: use the nice `module:http_url()` to get the correct url. diff -r 89b6d0e09b86 -r a74b07764d3f mod_invites_api/mod_invites_api.lua --- a/mod_invites_api/mod_invites_api.lua Wed Jul 26 18:45:41 2023 +0700 +++ b/mod_invites_api/mod_invites_api.lua Thu Jul 27 18:33:12 2023 +0700 @@ -10,7 +10,7 @@ -- on the server, use the option above instead. local allow_contact_invites = module:get_option_boolean("allow_contact_invites", true); -local api_key_store, api_key_store_kv, invites, date, config, path; +local api_key_store, api_key_store_kv, invites, date, config, path, url_base; -- COMPAT: workaround to avoid executing inside prosodyctl if prosody.shutdown then module:depends("http"); @@ -108,20 +108,8 @@ end local function get_url(id, token) - local config, path = module:get_option("http_paths"); - if config then - for k, v in pairs(config) do - if k == module.name then - path = v; - break; - else - path = "/"..module.name; - end - end - else path = "/"..module.name ; end - - local url_base = module:get_option_string("http_external_link", module.host); - return url_base..path.."?key="..id.."/"..token.."&redirect=true"; + local url_base = module:context(module.host):http_url(module.name, "/"..module.name); + return url_base.."?key="..id.."/"..token.."&redirect=true"; end function module.command(arg)