From 0b019ee4ebc92b2c0223258a887c360e473a5aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Wed, 2 Mar 2022 09:56:36 -0600 Subject: [PATCH] feat: Enables tenants/subdomains by default. --- .../rootfs/defaults/conf.d/jitsi-meet.cfg.lua | 10 +++++ web/rootfs/defaults/meet.conf | 38 +++++++++++++++++++ web/rootfs/defaults/system-config.js | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua b/prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua index bb1e570..20f487b 100644 --- a/prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua +++ b/prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua @@ -16,6 +16,7 @@ {{ $TURNS_PORT := .Env.TURNS_PORT | default "443" }} {{ $XMPP_MUC_DOMAIN_PREFIX := (split "." .Env.XMPP_MUC_DOMAIN)._0 }} {{ $DISABLE_POLLS := .Env.DISABLE_POLLS | default "false" | toBool -}} +{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}} admins = { "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}", @@ -216,6 +217,9 @@ Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc" {{ if not $DISABLE_POLLS -}} "polls"; {{ end -}} + {{ if $ENABLE_SUBDOMAINS -}} + "muc_domain_mapper"; + {{ end -}} } muc_room_cache_size = 1000 muc_room_locking = false @@ -249,4 +253,10 @@ Component "breakout.{{ .Env.XMPP_DOMAIN }}" "muc" restrict_room_creation = true muc_room_locking = false muc_room_default_public_jids = true + modules_enabled = { + "muc_meeting_id"; + {{ if $ENABLE_SUBDOMAINS -}} + "muc_domain_mapper"; + {{ end -}} + } {{ end }} diff --git a/web/rootfs/defaults/meet.conf b/web/rootfs/defaults/meet.conf index cd78631..cb84a73 100644 --- a/web/rootfs/defaults/meet.conf +++ b/web/rootfs/defaults/meet.conf @@ -1,5 +1,6 @@ {{ $ENABLE_COLIBRI_WEBSOCKET := .Env.ENABLE_COLIBRI_WEBSOCKET | default "1" | toBool }} {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }} +{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}} server_name _; @@ -104,3 +105,40 @@ location /etherpad/ { proxy_buffering off; } {{ end }} + +{{ if $ENABLE_SUBDOMAINS }} + location ~ ^/([^/?&:'"]+)/config.js$ + { + set $subdomain "$1."; + set $subdir "$1/"; + + alias /config/config.js; + } + + # BOSH for subdomains + location ~ ^/([^/?&:'"]+)/http-bind { + set $subdomain "$1."; + set $subdir "$1/"; + set $prefix "$1"; + + rewrite ^/(.*)$ /http-bind; + } + + {{ if $ENABLE_XMPP_WEBSOCKET }} + # websockets for subdomains + location ~ ^/([^/?&:'"]+)/xmpp-websocket { + set $subdomain "$1."; + set $subdir "$1/"; + set $prefix "$1"; + + rewrite ^/(.*)$ /xmpp-websocket; + } + {{ end }} + + # Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to / + location ~ ^/([^/?&:'"]+)/(.*)$ { + set $subdomain "$1."; + set $subdir "$1/"; + rewrite ^/([^/?&:'"]+)/(.*)$ /$2; + } +{{ end }} diff --git a/web/rootfs/defaults/system-config.js b/web/rootfs/defaults/system-config.js index 6026442..b72edef 100644 --- a/web/rootfs/defaults/system-config.js +++ b/web/rootfs/defaults/system-config.js @@ -1,7 +1,7 @@ {{ $CONFIG_EXTERNAL_CONNECT := .Env.CONFIG_EXTERNAL_CONNECT | default "false" | toBool -}} {{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "false" | toBool -}} {{ $ENABLE_GUESTS := .Env.ENABLE_GUESTS | default "false" | toBool -}} -{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "false" | toBool -}} +{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}} {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool -}} {{ $JICOFO_AUTH_USER := .Env.JICOFO_AUTH_USER | default "focus" }} {{ $PUBLIC_URL_DOMAIN := .Env.PUBLIC_URL | default "https://localhost:8443" | trimPrefix "https://" | trimSuffix "/" -}}