|
|
|
@ -21,7 +21,7 @@
|
|
|
|
|
#include "common/logging/log.h"
|
|
|
|
|
#include "core/announce_multiplayer_session.h"
|
|
|
|
|
#include "core/hle/service/cfg/cfg.h"
|
|
|
|
|
#include "core/settings.h"
|
|
|
|
|
#include "network/network_settings.h"
|
|
|
|
|
#include "ui_host_room.h"
|
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
|
#include "web_service/verify_user_jwt.h"
|
|
|
|
@ -53,9 +53,9 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
|
|
|
|
|
|
|
|
|
|
// Restore the settings:
|
|
|
|
|
ui->username->setText(UISettings::values.room_nickname);
|
|
|
|
|
if (ui->username->text().isEmpty() && !Settings::values.citra_username.empty()) {
|
|
|
|
|
if (ui->username->text().isEmpty() && !NetSettings::values.citra_username.empty()) {
|
|
|
|
|
// Use Citra Web Service user name as nickname by default
|
|
|
|
|
ui->username->setText(QString::fromStdString(Settings::values.citra_username));
|
|
|
|
|
ui->username->setText(QString::fromStdString(NetSettings::values.citra_username));
|
|
|
|
|
}
|
|
|
|
|
ui->room_name->setText(UISettings::values.room_name);
|
|
|
|
|
ui->port->setText(UISettings::values.room_port);
|
|
|
|
@ -92,7 +92,8 @@ std::unique_ptr<Network::VerifyUser::Backend> HostRoomWindow::CreateVerifyBacken
|
|
|
|
|
std::unique_ptr<Network::VerifyUser::Backend> verify_backend;
|
|
|
|
|
if (use_validation) {
|
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
|
verify_backend = std::make_unique<WebService::VerifyUserJWT>(Settings::values.web_api_url);
|
|
|
|
|
verify_backend =
|
|
|
|
|
std::make_unique<WebService::VerifyUserJWT>(NetSettings::values.web_api_url);
|
|
|
|
|
#else
|
|
|
|
|
verify_backend = std::make_unique<Network::VerifyUser::NullBackend>();
|
|
|
|
|
#endif
|
|
|
|
@ -144,7 +145,7 @@ void HostRoomWindow::Host() {
|
|
|
|
|
bool created = room->Create(ui->room_name->text().toStdString(),
|
|
|
|
|
ui->room_description->toPlainText().toStdString(), "", port,
|
|
|
|
|
password, ui->max_player->value(),
|
|
|
|
|
Settings::values.citra_username, game_name.toStdString(),
|
|
|
|
|
NetSettings::values.citra_username, game_name.toStdString(),
|
|
|
|
|
game_id, CreateVerifyBackend(is_public), ban_list);
|
|
|
|
|
if (!created) {
|
|
|
|
|
NetworkMessage::ErrorManager::ShowError(
|
|
|
|
@ -182,8 +183,9 @@ void HostRoomWindow::Host() {
|
|
|
|
|
std::string token;
|
|
|
|
|
#ifdef ENABLE_WEB_SERVICE
|
|
|
|
|
if (is_public) {
|
|
|
|
|
WebService::Client client(Settings::values.web_api_url, Settings::values.citra_username,
|
|
|
|
|
Settings::values.citra_token);
|
|
|
|
|
WebService::Client client(NetSettings::values.web_api_url,
|
|
|
|
|
NetSettings::values.citra_username,
|
|
|
|
|
NetSettings::values.citra_token);
|
|
|
|
|
if (auto room = Network::GetRoom().lock()) {
|
|
|
|
|
token = client.GetExternalJWT(room->GetVerifyUID()).returned_data;
|
|
|
|
|
}
|
|
|
|
@ -210,7 +212,6 @@ void HostRoomWindow::Host() {
|
|
|
|
|
? ui->port->text()
|
|
|
|
|
: QString::number(Network::DefaultRoomPort);
|
|
|
|
|
UISettings::values.room_description = ui->room_description->toPlainText();
|
|
|
|
|
Settings::Apply();
|
|
|
|
|
ui->host->setEnabled(true);
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|