diff --git a/src/WebSocketProtocol.cpp b/src/WebSocketProtocol.cpp index 303a3e93..33cf95f4 100644 --- a/src/WebSocketProtocol.cpp +++ b/src/WebSocketProtocol.cpp @@ -66,6 +66,7 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se if (!incomingMessage.contains("messageType")) { if (incomingMessage.contains("request-type")) { + blog(LOG_WARNING, "Client %s appears to be running a pre-5.0.0 protocol.", session->RemoteAddress().c_str()) ret.closeCode = WebSocketServer::WebSocketCloseCode::UnsupportedProtocolVersion; ret.closeReason = "You appear to be attempting to connect with the pre-5.0.0 plugin protocol. Check to make sure your client is updated."; return ret; @@ -191,10 +192,8 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se if (!Utils::Crypto::CheckAuthenticationString(session->Secret(), session->Challenge(), incomingMessage["authentication"])) { auto conf = GetConfig(); if (conf && conf->AlertsEnabled) { - obs_frontend_push_ui_translation(obs_module_get_string); - QString title = QObject::tr("OBSWebSocket.TrayNotification.AuthenticationFailed.Title"); - QString body = QObject::tr("OBSWebSocket.TrayNotification.AuthenticationFailed.Body").arg(QString::fromStdString(session->RemoteAddress())); - obs_frontend_pop_ui_translation(); + QString title = obs_module_text("OBSWebSocket.TrayNotification.AuthenticationFailed.Title"); + QString body = QString(obs_module_text("OBSWebSocket.TrayNotification.AuthenticationFailed.Body")).arg(QString::fromStdString(session->RemoteAddress())); Utils::Platform::SendTrayNotification(QSystemTrayIcon::Warning, title, body); } ret.closeCode = WebSocketServer::WebSocketCloseCode::AuthenticationFailed; @@ -225,10 +224,8 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se auto conf = GetConfig(); if (conf && conf->AlertsEnabled) { - obs_frontend_push_ui_translation(obs_module_get_string); - QString title = QObject::tr("OBSWebSocket.TrayNotification.Identified.Title"); - QString body = QObject::tr("OBSWebSocket.TrayNotification.Identified.Body").arg(QString::fromStdString(session->RemoteAddress())); - obs_frontend_pop_ui_translation(); + QString title = obs_module_text("OBSWebSocket.TrayNotification.Identified.Title"); + QString body = QString(obs_module_text("OBSWebSocket.TrayNotification.Identified.Body")).arg(QString::fromStdString(session->RemoteAddress())); Utils::Platform::SendTrayNotification(QSystemTrayIcon::Information, title, body); } diff --git a/src/WebSocketServer.cpp b/src/WebSocketServer.cpp index 418e5ba4..bf0f7d52 100644 --- a/src/WebSocketServer.cpp +++ b/src/WebSocketServer.cpp @@ -2,7 +2,6 @@ #include #include #include - #include #include @@ -353,10 +352,8 @@ void WebSocketServer::onClose(websocketpp::connection_hdl hdl) // If previously identified, not going away, and notifications enabled, send a tray notification if (isIdentified && (conn->get_local_close_code() != websocketpp::close::status::going_away) && conf->AlertsEnabled) { - obs_frontend_push_ui_translation(obs_module_get_string); - QString title = QObject::tr("OBSWebSocket.TrayNotification.Disconnected.Title"); - QString body = QObject::tr("OBSWebSocket.TrayNotification.Disconnected.Body").arg(QString::fromStdString(remoteAddress)); - obs_frontend_pop_ui_translation(); + QString title = obs_module_text("OBSWebSocket.TrayNotification.Disconnected.Title"); + QString body = QString(obs_module_text("OBSWebSocket.TrayNotification.Disconnected.Body")).arg(QString::fromStdString(remoteAddress)); Utils::Platform::SendTrayNotification(QSystemTrayIcon::Information, title, body); } } diff --git a/src/forms/ConnectInfo.cpp b/src/forms/ConnectInfo.cpp index 99da7d60..c06e7eac 100644 --- a/src/forms/ConnectInfo.cpp +++ b/src/forms/ConnectInfo.cpp @@ -1,7 +1,6 @@ -#include -#include #include #include +#include #include "../../deps/qr/cpp/QrCode.hpp" #include "ConnectInfo.h" @@ -50,9 +49,7 @@ void ConnectInfo::showEvent(QShowEvent *event) serverPassword = conf->ServerPassword; } else { ui->copyServerPasswordButton->setEnabled(false); - obs_frontend_push_ui_translation(obs_module_get_string); - serverPassword = QObject::tr("OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText"); - obs_frontend_pop_ui_translation(); + serverPassword = obs_module_text("OBSWebSocket.ConnectInfo.ServerPasswordPlaceholderText"); } ui->serverPasswordLineEdit->setText(serverPassword); diff --git a/src/forms/SettingsDialog.cpp b/src/forms/SettingsDialog.cpp index 5e1c4b54..be1ffabd 100644 --- a/src/forms/SettingsDialog.cpp +++ b/src/forms/SettingsDialog.cpp @@ -1,8 +1,8 @@ -#include -#include #include #include #include +#include +#include #include "SettingsDialog.h" #include "../obs-websocket.h" @@ -190,9 +190,7 @@ void SettingsDialog::FillSessionTable() QPixmap crossIconPixmap = crossIcon.pixmap(QSize(25, 25)); // Todo: Make a util for translations so that we don't need to import a bunch of obs libraries in order to use them. - obs_frontend_push_ui_translation(obs_module_get_string); - QString kickButtonText = QObject::tr("OBSWebSocket.SessionTable.KickButtonText"); - obs_frontend_pop_ui_translation(); + QString kickButtonText = obs_module_text("OBSWebSocket.SessionTable.KickButtonText"); ui->websocketSessionTable->setRowCount(rowCount); size_t i = 0; diff --git a/src/obs-websocket.cpp b/src/obs-websocket.cpp index 77c67cac..55ee05a5 100644 --- a/src/obs-websocket.cpp +++ b/src/obs-websocket.cpp @@ -1,11 +1,10 @@ -#include -#include -#include - #include #include #include #include +#include +#include +#include #include "obs-websocket.h" #include "Config.h"