fix: auto-normalize http(s) URLs to ws(s) in bot plugins

Users behind reverse proxies naturally configure https:// URLs.
The websocket-client library requires ws:// or wss:// schemes.
Both plugins now auto-convert before connecting.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-12 08:01:11 -04:00
parent f6840a777c
commit f244749293
2 changed files with 8 additions and 0 deletions

View File

@@ -143,6 +143,10 @@ class NtrPlaylist(callbacks.Plugin):
while not self._ws_stop.is_set():
ws_url = self.registryValue("wsUrl")
if ws_url.startswith("https://"):
ws_url = "wss://" + ws_url[8:]
elif ws_url.startswith("http://"):
ws_url = "ws://" + ws_url[7:]
token = self.registryValue("adminToken")
channel = self.registryValue("announceChannel")
client_id = self.registryValue("clientId") or "limnoria"

View File

@@ -54,6 +54,10 @@ def _ws_listener(bot):
while not _ws_stop.is_set():
ws_url = bot.settings.ntr_playlist.ws_url
if ws_url.startswith("https://"):
ws_url = "wss://" + ws_url[8:]
elif ws_url.startswith("http://"):
ws_url = "ws://" + ws_url[7:]
token = bot.settings.ntr_playlist.admin_token
channel = bot.settings.ntr_playlist.announce_channel
client_id = bot.settings.ntr_playlist.client_id or "sopel"