comparison 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
comparison
equal deleted inserted replaced
6518:b66c93276534 6519:01d8bfbfc435
1 local config = require "core.configmanager";
1 local http = require "net.http"; 2 local http = require "net.http";
2 local json = require "util.json"; 3 local json = require "util.json";
3 local st = require "util.stanza"; 4 local st = require "util.stanza";
4 local new_id = require"util.id".medium; 5 local new_id = require"util.id".medium;
5 6
12 local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json"); 13 local public_providers_url = module:get_option_string(module.name.."_public_providers_url", "https://data.xmpp.net/providers/v2/providers-Ds.json");
13 local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false); 14 local delete_node_on_unload = module:get_option_boolean(module.name.."_delete_node_on_unload", false);
14 local persist_items = module:get_option_boolean(module.name.."_persist_items", true); 15 local persist_items = module:get_option_boolean(module.name.."_persist_items", true);
15 local include_user_count = module:get_option_boolean(module.name.."_publish_user_count", false); 16 local include_user_count = module:get_option_boolean(module.name.."_publish_user_count", false);
16 17
17 if not service and prosody.hosts["pubsub."..module.host] then 18 if not service and config.getconfig()["pubsub."..module.host] then
19 -- Only use this default if such a domain is found in the config
18 service = "pubsub."..module.host; 20 service = "pubsub."..module.host;
19 end 21 end
20 if not service then 22 if not service then
21 module:log_status("warn", "No pubsub service specified - module not activated"); 23 module:log_status("warn", "No pubsub service specified - module not activated");
22 return; 24 return;