Mercurial > prosody-modules
diff mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua @ 6519:01d8bfbfc435
mod_pubsub_serverinfo: Fix check for local domain
The module was checking whether a host exists, but this may be misleading if
our host is loaded before the host that is being checked.
This change makes it check the config. This will provide a false positive in
the rare case that the host is defined but not activated/enabled. But we don't
have an API currently for "is this host configured and enabled?"
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 21 Apr 2026 19:54:19 +0100 |
| parents | 13c61a068c71 |
| children |
line wrap: on
line diff
--- a/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Thu Apr 16 12:19:48 2026 +0200 +++ b/mod_pubsub_serverinfo/mod_pubsub_serverinfo.lua Tue Apr 21 19:54:19 2026 +0100 @@ -1,3 +1,4 @@ +local config = require "core.configmanager"; local http = require "net.http"; local json = require "util.json"; local st = require "util.stanza"; @@ -14,7 +15,8 @@ local persist_items = module:get_option_boolean(module.name.."_persist_items", true); local include_user_count = module:get_option_boolean(module.name.."_publish_user_count", false); -if not service and prosody.hosts["pubsub."..module.host] then +if not service and config.getconfig()["pubsub."..module.host] then + -- Only use this default if such a domain is found in the config service = "pubsub."..module.host; end if not service then
