Add /servatrice to websocket URL to help out reverse proxies. (#3551)
Remove unused define Use websocket port from default servers if given.
This commit is contained in:
parent
544c66edde
commit
c1d25bf58b
3 changed files with 5 additions and 3 deletions
|
@ -14,8 +14,6 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
|
||||||
#define PUBLIC_SERVERS_URL "https://github.com/Cockatrice/Cockatrice/wiki/Public-Servers"
|
|
||||||
|
|
||||||
DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
previousHostButton = new QRadioButton(tr("Known Hosts"), this);
|
previousHostButton = new QRadioButton(tr("Known Hosts"), this);
|
||||||
|
|
|
@ -71,6 +71,10 @@ void HandlePublicServers::updateServerINISettings(QMap<QString, QVariant> jsonMa
|
||||||
QString serverPort = serverMap["port"].toString();
|
QString serverPort = serverMap["port"].toString();
|
||||||
QString serverSite = serverMap["site"].toString();
|
QString serverSite = serverMap["site"].toString();
|
||||||
|
|
||||||
|
if (serverMap.contains("websocketPort")) {
|
||||||
|
serverPort = serverMap["websocketPort"].toString();
|
||||||
|
}
|
||||||
|
|
||||||
bool serverFound = false;
|
bool serverFound = false;
|
||||||
for (const auto &iter : savedHostList) {
|
for (const auto &iter : savedHostList) {
|
||||||
// If the URL/IP matches
|
// If the URL/IP matches
|
||||||
|
|
|
@ -359,7 +359,7 @@ void RemoteClient::connectToHost(const QString &hostname, unsigned int port)
|
||||||
{
|
{
|
||||||
usingWebSocket = port == 443 || port == 80 || port == 4748 || port == 8080;
|
usingWebSocket = port == 443 || port == 80 || port == 4748 || port == 8080;
|
||||||
if (usingWebSocket) {
|
if (usingWebSocket) {
|
||||||
QUrl url(QString("%1://%2:%3").arg(port == 443 ? "wss" : "ws").arg(hostname).arg(port));
|
QUrl url(QString("%1://%2:%3/servatrice").arg(port == 443 ? "wss" : "ws").arg(hostname).arg(port));
|
||||||
websocket->open(url);
|
websocket->open(url);
|
||||||
} else {
|
} else {
|
||||||
socket->connectToHost(hostname, static_cast<quint16>(port));
|
socket->connectToHost(hostname, static_cast<quint16>(port));
|
||||||
|
|
Loading…
Reference in a new issue