From c3df6dfd5000e156d3b113aae07dc6d9c798e0f6 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 26 Sep 2025 09:44:55 -0500 Subject: [PATCH] feat(prosody): Configure polls for visitors. --- prosody/rootfs/defaults/conf.d/visitors.cfg.lua | 9 +++++++++ prosody/rootfs/defaults/prosody.cfg.lua | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/prosody/rootfs/defaults/conf.d/visitors.cfg.lua b/prosody/rootfs/defaults/conf.d/visitors.cfg.lua index 9df3d16..3478b36 100644 --- a/prosody/rootfs/defaults/conf.d/visitors.cfg.lua +++ b/prosody/rootfs/defaults/conf.d/visitors.cfg.lua @@ -1,3 +1,4 @@ +{{ $DISABLE_POLLS := .Env.DISABLE_POLLS | default "false" | toBool -}} {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool -}} {{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool) -}} {{ $ENABLE_RATE_LIMITS := .Env.PROSODY_ENABLE_RATE_LIMITS | default "0" | toBool -}} @@ -79,6 +80,9 @@ s2sout_override = { ["{{ $vhost }}"] = "tcp://{{ $XMPP_SERVER }}:{{ $XMPP_SERVER_S2S_PORT }}"; {{ end -}} {{ end -}} +{{ if not $DISABLE_POLLS -}} + ['polls.{{ $XMPP_DOMAIN }}'] = "tcp://{{ $XMPP_SERVER }}:{{ $XMPP_SERVER_S2S_PORT }}"; +{{ end -}} } @@ -102,6 +106,7 @@ VirtualHost 'v{{ $VISITOR_INDEX }}.{{ $VISITORS_XMPP_DOMAIN }}' {{ if .Env.XMPP_MODULES }} "{{ join "\";\n\"" (splitList "," .Env.XMPP_MODULES | compact) }}"; {{ end }} + 'features_identity'; } main_muc = '{{ $VISITORS_MUC_PREFIX }}.v{{ $VISITOR_INDEX }}.{{ $VISITORS_XMPP_DOMAIN }}'; shard_name = "{{ $SHARD_NAME }}" @@ -186,3 +191,7 @@ Component '{{ $VISITORS_MUC_PREFIX }}.v{{ $VISITOR_INDEX }}.{{ $VISITORS_XMPP_DO {{ if .Env.XMPP_MUC_CONFIGURATION -}} {{ join "\n" (splitList "," .Env.XMPP_MUC_CONFIGURATION | compact) }} {{ end -}} + +{{ if not $DISABLE_POLLS -}} +Component 'polls.v{{ $VISITOR_INDEX }}.{{ $VISITORS_XMPP_DOMAIN }}'' 'polls_component' +{{ end -}} diff --git a/prosody/rootfs/defaults/prosody.cfg.lua b/prosody/rootfs/defaults/prosody.cfg.lua index 12ccdee..04d752d 100644 --- a/prosody/rootfs/defaults/prosody.cfg.lua +++ b/prosody/rootfs/defaults/prosody.cfg.lua @@ -1,5 +1,6 @@ {{ $C2S_REQUIRE_ENCRYPTION := .Env.PROSODY_C2S_REQUIRE_ENCRYPTION | default "1" | toBool -}} {{ $DISABLE_C2S_LIMIT := .Env.PROSODY_DISABLE_C2S_LIMIT | default "0" | toBool -}} +{{ $DISABLE_POLLS := .Env.DISABLE_POLLS | default "false" | toBool -}} {{ $DISABLE_S2S_LIMIT := .Env.PROSODY_DISABLE_S2S_LIMIT | default "0" | toBool -}} {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool -}} {{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool) -}} @@ -242,6 +243,9 @@ s2s_whitelist = { '{{ $XMPP_MUC_DOMAIN }}'; -- needed for visitors to send messages to main room 'visitors.{{ $XMPP_DOMAIN }}'; -- needed for sending promotion request to visitors.{{ $XMPP_DOMAIN }} component '{{ $XMPP_DOMAIN }}'; -- unavailable presences back to main room + {{- if not $DISABLE_POLLS }} + 'polls.{{ $XMPP_DOMAIN }}'; + {{- end }} {{- end }} {{- if $ENABLE_GUEST_DOMAIN }} @@ -267,12 +271,14 @@ s2sout_override = { {{ $DEFAULT_PORT := add $VISITORS_XMPP_PORT $index }} ["{{ $VISITORS_MUC_PREFIX }}.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"] = "tcp://{{ $SERVER._0 }}:{{ $SERVER._1 | default $DEFAULT_PORT }}"; ["v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"] = "tcp://{{ $SERVER._0 }}:{{ $SERVER._1 | default $DEFAULT_PORT }}"; + ["polls.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"] = "tcp://{{ $SERVER._0 }}:{{ $SERVER._1 | default $DEFAULT_PORT }}"; {{ end -}} }; {{ if ne $PROSODY_MODE "visitors" -}} s2s_whitelist = { {{ range $index, $element := $VISITORS_XMPP_SERVERS -}} "{{ $VISITORS_MUC_PREFIX }}.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"; + "polls.v{{ $index }}.{{ $VISITORS_XMPP_DOMAIN }}"; {{ end -}} }; {{ end -}}