From c097f5a596ce3cfe10bc4dfcead4fb4fb0363985 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Wed, 31 May 2023 14:51:02 +0200 Subject: [PATCH] Enabling again direct s2s. --- CHANGELOG.md | 1 - .../mod_s2s_peertubelivechat.lua | 13 ++++++------- .../mod_websocket_s2s_peertubelivechat.lua | 5 +++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdb5790b..1c1fa52d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,6 @@ TODO: it seems that in some case A->B can be Websocket, and B->A direct S2S. Che TODO?: always generate self-signed certificates. Could be used for outgoing s2s? TODO: check in the diagnostic tool that Prosody is >=0.12 TODO?: allow directs2s on one side and websocket on the other? (currently disallowed by compatibleRemoteAuthenticatedConnectionEnabled) -TODO: alpha.4 version force Websocket S2S when available, even if s2s is possible. Revert this before releasing. TODO: for directS2S, needs a SRV records for the main host if port is not standard.. Must document. ### Minor changes and fixes diff --git a/prosody-modules/mod_s2s_peertubelivechat/mod_s2s_peertubelivechat.lua b/prosody-modules/mod_s2s_peertubelivechat/mod_s2s_peertubelivechat.lua index ea416cc4..a7b47cea 100644 --- a/prosody-modules/mod_s2s_peertubelivechat/mod_s2s_peertubelivechat.lua +++ b/prosody-modules/mod_s2s_peertubelivechat/mod_s2s_peertubelivechat.lua @@ -10,13 +10,12 @@ function discover_websocket_s2s(event) local to_host = event.to_host; module:log("debug", "Searching websocket s2s for remote host %s", to_host); - -- FIXME: this was commented for the 6.4.0-alpha4, to test ws s2s. Revert before releasing. - -- local f_s2s = io.open(path.join(server_infos_dir, to_host, 's2s'), "r"); - -- if f_s2s ~= nil then - -- io.close(f_s2s); - -- module:log("debug", "Remote host is a known Peertube %s that has s2s activated, we will let legacy s2s module handle the connection", to_host); - -- return; - -- end + local f_s2s = io.open(path.join(server_infos_dir, to_host, 's2s'), "r"); + if f_s2s ~= nil then + io.close(f_s2s); + module:log("debug", "Remote host is a known Peertube %s that has s2s activated, we will let legacy s2s module handle the connection", to_host); + return; + end local f_ws_proxy = io.open(path.join(server_infos_dir, to_host, 'ws-s2s'), "r"); if f_ws_proxy == nil then diff --git a/prosody-modules/mod_websocket_s2s_peertubelivechat/mod_websocket_s2s_peertubelivechat.lua b/prosody-modules/mod_websocket_s2s_peertubelivechat/mod_websocket_s2s_peertubelivechat.lua index 122e820b..8b4b4fe8 100644 --- a/prosody-modules/mod_websocket_s2s_peertubelivechat/mod_websocket_s2s_peertubelivechat.lua +++ b/prosody-modules/mod_websocket_s2s_peertubelivechat/mod_websocket_s2s_peertubelivechat.lua @@ -542,16 +542,17 @@ end function route_to_new_session(event) local from_host, to_host, stanza = event.from_host, event.to_host, event.stanza; - log("debug", "Trying to route to %s using Websocket S2S", to_host); + log("debug", "Trying to route to %s, searching which method to use", to_host); local ws_properties = module:fire_event("discover-websocket-s2s", { to_host = to_host }); if not ws_properties then - log("debug", "No websocket s2s capabilities from remote host %s", to_host); + log("debug", "Not using websocket s2s from remote host %s", to_host); return; end local ws_url = ws_properties.url; if (not ws_url) then log("error", "Missing url in the discover-websocket-s2s result"); + return; end log("debug", "Found a Websocket endpoint for s2s communications to remote host %s", to_host);