fixes for wasm client

- ui_enum
- spdlog pthread
- url hostname from emscripten
- websocket ping pong not exposed on js
- version string in client
- cleanup the generation of the version string
- set fixed path for wasm ws
This commit is contained in:
2026-06-12 13:07:04 +02:00
parent 5495e20b1e
commit d08fd90e63
8 changed files with 52 additions and 21 deletions
+10 -6
View File
@@ -33,9 +33,10 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription("unisim_cpp client\n\tversion: " + QString::fromStdString(Git_version::branch) +
"-" + QString::fromStdString(Git_version::shortSha1) +
QString::fromStdString(Git_version::dirty ? "-dirty" : ""));
parser.setApplicationDescription(QString("unisim_cpp client\n\tVersion: %1-%2%3")
.arg(Git_version::branch)
.arg(Git_version::shortSha1)
.arg(Git_version::dirty ? "-dirty" : ""));
parser.addHelpOption();
QCommandLineOption host_option(QStringList() << "s"
@@ -70,11 +71,15 @@ int main(int argc, char *argv[])
.value_or(spdlog::level::off));
QUrl url;
url.setScheme("ws");
#ifdef EMSCRIPTEN
emscripten::val location = emscripten::val::global("location");
url.setHost(QString::fromStdString(location["href"].as<std::string>()));
url.setHost(QString::fromStdString(location["hostname"].as<std::string>()));
url.setPath("/ws");
url.setPort(443);
url.setScheme("wss");
#else
url.setScheme("ws");
url.setPort(parser.value(port_option).toInt());
url.setHost(parser.value(host_option));
#if defined(__linux__)
if (parser.value(host_option).endsWith(".local"))
@@ -101,7 +106,6 @@ int main(int argc, char *argv[])
}
#endif
#endif
url.setPort(parser.value(port_option).toInt());
QString default_sim = parser.value(default_sim_option);
SPDLOG_INFO("Connecting client on {}", url.toString().toStdString());
MainWindow w(url, default_sim);