aboutsummaryrefslogtreecommitdiff
path: root/src/options.cpp
diff options
context:
space:
mode:
authorOsmium Sorcerer <os@sof.beauty>2026-03-22 17:57:13 +0000
committerOsmium Sorcerer <os@sof.beauty>2026-03-29 22:22:25 +0000
commit79c2262cae02b513aee70943f7e07a9205316bdf (patch)
tree02efb824bad180a11bd1b68c41508088c167434b /src/options.cpp
parent06f34c776972542222623ca4f91880de97993fbf (diff)
Support Secure WebSocket
Add full WSS support to public server list (using wss_port, overriding insecure port), favorite servers list, and direct connections, and show which servers are secure. Revert the upstream's removal of `legacy` ServerInfo field, as I use it to filter out legacy servers. To differentiate schemes, the `scheme` field is used, either "ws" or "wss". I don't see the reason to add "tcp" protocol when we don't even support it. For the UI, add icons for secure and insecure connections. Highlight secure servers with a green background. In the favorite server dialog, a checkbox was added to select whether the server is using WSS. In the direct connection dialog, support "wss" scheme and default ports: 80 for WS, 443 for WSS, as per the WebSocket specification.
Diffstat (limited to 'src/options.cpp')
-rw-r--r--src/options.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/options.cpp b/src/options.cpp
index d25eea09..3d400c25 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -678,14 +678,7 @@ QVector<ServerInfo> Options::favorites()
f_server.port = favorite.value("port", 27016).toInt();
f_server.name = favorite.value("name", "Missing Name").toString();
f_server.description = favorite.value("desc", "No description").toString();
- if (favorite.contains("protocol"))
- {
- f_server.protocol = favorite.value("protocol").toString();
- }
- else
- {
- f_server.protocol = "tcp";
- }
+ f_server.scheme = favorite.value("scheme", "ws").toString();
serverlist.append(std::move(f_server));
favorite.endGroup();
@@ -705,7 +698,8 @@ void Options::setFavorites(QVector<ServerInfo> value)
favorite.setValue("address", fav_server.address);
favorite.setValue("port", fav_server.port);
favorite.setValue("desc", fav_server.description);
- favorite.setValue("protocol", fav_server.protocol);
+ favorite.setValue("legacy", fav_server.legacy);
+ favorite.setValue("scheme", fav_server.scheme);
favorite.endGroup();
}
favorite.sync();
@@ -726,7 +720,8 @@ void Options::addFavorite(ServerInfo server)
favorite.setValue("address", server.address);
favorite.setValue("port", server.port);
favorite.setValue("desc", server.description);
- favorite.setValue("protocol", server.protocol);
+ favorite.setValue("legacy", server.legacy);
+ favorite.setValue("scheme", server.scheme);
favorite.endGroup();
favorite.sync();
}
@@ -738,7 +733,8 @@ void Options::updateFavorite(ServerInfo server, int index)
favorite.setValue("address", server.address);
favorite.setValue("port", server.port);
favorite.setValue("desc", server.description);
- favorite.setValue("protocol", server.protocol);
+ favorite.setValue("legacy", server.legacy);
+ favorite.setValue("scheme", server.scheme);
favorite.endGroup();
favorite.sync();
}