Remove bad protoswitching from previous commit

This commit is contained in:
Speng Reb 2026-04-21 00:27:20 +02:00
parent 80cd107aa0
commit 6efb8902fa
2 changed files with 2 additions and 7 deletions

View file

@ -29,9 +29,7 @@ function checkAdmin(cb) {
*/ */
function handleAcp(req, res, _user) { function handleAcp(req, res, _user) {
const ioServers = ioConfig.getSocketEndpoints(); const ioServers = ioConfig.getSocketEndpoints();
const preferredSecure = req.realProtocol === 'https'; const chosenServer = ioServers[0];
const chosenServer = ioServers.find((server) => server.secure === preferredSecure) ||
ioServers[0];
if (!chosenServer) { if (!chosenServer) {
res.status(500).text("No suitable socket.io address for ACP"); res.status(500).text("No suitable socket.io address for ACP");

View file

@ -24,10 +24,7 @@ export default function initialize(app, ioConfig, chanPath, getBannedChannel) {
if (endpoints.length === 0) { if (endpoints.length === 0) {
throw new HTTPError('No socket.io endpoints configured'); throw new HTTPError('No socket.io endpoints configured');
} }
const preferredSecure = req.realProtocol === 'https'; const socketBaseURL = endpoints[0].url;
const chosenEndpoint = endpoints.find((endpoint) => endpoint.secure === preferredSecure) ||
endpoints[0];
const socketBaseURL = chosenEndpoint.url;
sendPug(res, 'channel', { sendPug(res, 'channel', {
channelName: req.params.channel, channelName: req.params.channel,