mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-24 17:47:05 +02:00
Added the public lobby to android. (#125)
This is adapted from kleidis old PR to Azahar. Changes from it: - Fixed inconsistent button styling in the dialog for connection - Allowed to hide both empty and full rooms. - Proper serving of preferred games - Enables web service for android by default - Better implementation of multiplayer.cpp that works with oop Also fixes the room network class and turns it into a static namespace in network Signed-off-by: Aleksandr Popovich <alekpopo@pm.me> Co-authored-by: swurl <swurl@swurl.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/125 Co-authored-by: Aleksandr Popovich <alekpopo@pm.me> Co-committed-by: Aleksandr Popovich <alekpopo@pm.me>
This commit is contained in:
parent
7e13da47af
commit
76fa525592
99 changed files with 1470 additions and 498 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project / Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <QInputDialog>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project / Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "yuzu/configuration/configure_ui.h"
|
||||
|
|
|
|||
|
|
@ -9,30 +9,30 @@
|
|||
#include "yuzu/configuration/configure_web.h"
|
||||
#include "yuzu/uisettings.h"
|
||||
|
||||
static constexpr char token_delimiter{':'};
|
||||
// static constexpr char token_delimiter{':'};
|
||||
|
||||
static std::string GenerateDisplayToken(const std::string& username, const std::string& token) {
|
||||
if (username.empty() || token.empty()) {
|
||||
return {};
|
||||
}
|
||||
// static std::string GenerateDisplayToken(const std::string& username, const std::string& token) {
|
||||
// if (username.empty() || token.empty()) {
|
||||
// return {};
|
||||
// }
|
||||
|
||||
const std::string unencoded_display_token{username + token_delimiter + token};
|
||||
QByteArray b{unencoded_display_token.c_str()};
|
||||
QByteArray b64 = b.toBase64();
|
||||
return b64.toStdString();
|
||||
}
|
||||
// const std::string unencoded_display_token{username + token_delimiter + token};
|
||||
// QByteArray b{unencoded_display_token.c_str()};
|
||||
// QByteArray b64 = b.toBase64();
|
||||
// return b64.toStdString();
|
||||
// }
|
||||
|
||||
static std::string UsernameFromDisplayToken(const std::string& display_token) {
|
||||
const std::string unencoded_display_token{
|
||||
QByteArray::fromBase64(display_token.c_str()).toStdString()};
|
||||
return unencoded_display_token.substr(0, unencoded_display_token.find(token_delimiter));
|
||||
}
|
||||
// static std::string UsernameFromDisplayToken(const std::string& display_token) {
|
||||
// const std::string unencoded_display_token{
|
||||
// QByteArray::fromBase64(display_token.c_str()).toStdString()};
|
||||
// return unencoded_display_token.substr(0, unencoded_display_token.find(token_delimiter));
|
||||
// }
|
||||
|
||||
static std::string TokenFromDisplayToken(const std::string& display_token) {
|
||||
const std::string unencoded_display_token{
|
||||
QByteArray::fromBase64(display_token.c_str()).toStdString()};
|
||||
return unencoded_display_token.substr(unencoded_display_token.find(token_delimiter) + 1);
|
||||
}
|
||||
// static std::string TokenFromDisplayToken(const std::string& display_token) {
|
||||
// const std::string unencoded_display_token{
|
||||
// QByteArray::fromBase64(display_token.c_str()).toStdString()};
|
||||
// return unencoded_display_token.substr(unencoded_display_token.find(token_delimiter) + 1);
|
||||
// }
|
||||
|
||||
ConfigureWeb::ConfigureWeb(QWidget* parent)
|
||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureWeb>()) {
|
||||
|
|
@ -66,7 +66,7 @@ void ConfigureWeb::RetranslateUI() {
|
|||
"color:#039be5;\">Sign up</span></a>"));
|
||||
|
||||
ui->web_token_info_link->setText(
|
||||
tr("<a href='https://eden-emulator.github.io/wiki/yuzu-web-service/'><span style=\"text-decoration: "
|
||||
tr("<a href='https://evilperson1337.notion.site/Hosting-a-Room-Inside-of-Eden-20457c2edaf680108abac6215a79acdb'><span style=\"text-decoration: "
|
||||
"underline; color:#039be5;\">What is my token?</span></a>"));
|
||||
}
|
||||
|
||||
|
|
@ -76,14 +76,10 @@ void ConfigureWeb::SetConfiguration() {
|
|||
ui->web_signup_link->setOpenExternalLinks(true);
|
||||
ui->web_token_info_link->setOpenExternalLinks(true);
|
||||
|
||||
if (Settings::values.yuzu_username.GetValue().empty()) {
|
||||
ui->username->setText(tr("Unspecified"));
|
||||
} else {
|
||||
ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue()));
|
||||
}
|
||||
|
||||
ui->edit_token->setText(QString::fromStdString(GenerateDisplayToken(
|
||||
Settings::values.yuzu_username.GetValue(), Settings::values.yuzu_token.GetValue())));
|
||||
ui->edit_username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue()));
|
||||
ui->edit_token->setText(QString::fromStdString(Settings::values.yuzu_token.GetValue()));
|
||||
// ui->edit_token->setText(QString::fromStdString(GenerateDisplayToken(
|
||||
// Settings::values.yuzu_username.GetValue(), Settings::values.yuzu_token.GetValue())));
|
||||
|
||||
// Connect after setting the values, to avoid calling OnLoginChanged now
|
||||
connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged);
|
||||
|
|
@ -95,15 +91,8 @@ void ConfigureWeb::SetConfiguration() {
|
|||
|
||||
void ConfigureWeb::ApplyConfiguration() {
|
||||
UISettings::values.enable_discord_presence = ui->toggle_discordrpc->isChecked();
|
||||
if (user_verified) {
|
||||
Settings::values.yuzu_username =
|
||||
UsernameFromDisplayToken(ui->edit_token->text().toStdString());
|
||||
Settings::values.yuzu_token = TokenFromDisplayToken(ui->edit_token->text().toStdString());
|
||||
} else {
|
||||
QMessageBox::warning(
|
||||
this, tr("Token not verified"),
|
||||
tr("Token was not verified. The change to your token has not been saved."));
|
||||
}
|
||||
Settings::values.yuzu_username = ui->edit_username->text().toStdString();
|
||||
Settings::values.yuzu_token = ui->edit_token->text().toStdString();
|
||||
}
|
||||
|
||||
void ConfigureWeb::OnLoginChanged() {
|
||||
|
|
@ -124,30 +113,34 @@ void ConfigureWeb::OnLoginChanged() {
|
|||
}
|
||||
|
||||
void ConfigureWeb::VerifyLogin() {
|
||||
ui->button_verify_login->setDisabled(true);
|
||||
ui->button_verify_login->setText(tr("Verifying..."));
|
||||
ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("sync")).pixmap(16));
|
||||
ui->label_token_verified->setToolTip(tr("Verifying..."));
|
||||
QMessageBox::warning(this,
|
||||
tr("Warning"),
|
||||
tr("Verification is currently nonfunctional, instead generate a random "
|
||||
"48-character string with only lowercase a-z."));
|
||||
// ui->button_verify_login->setDisabled(true);
|
||||
// ui->button_verify_login->setText(tr("Verifying..."));
|
||||
// ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("sync")).pixmap(16));
|
||||
// ui->label_token_verified->setToolTip(tr("Verifying..."));
|
||||
}
|
||||
|
||||
void ConfigureWeb::OnLoginVerified() {
|
||||
ui->button_verify_login->setEnabled(true);
|
||||
ui->button_verify_login->setText(tr("Verify"));
|
||||
if (verify_watcher.result()) {
|
||||
user_verified = true;
|
||||
// ui->button_verify_login->setEnabled(true);
|
||||
// ui->button_verify_login->setText(tr("Verify"));
|
||||
// if (verify_watcher.result()) {
|
||||
// user_verified = true;
|
||||
|
||||
ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("checked")).pixmap(16));
|
||||
ui->label_token_verified->setToolTip(tr("Verified", "Tooltip"));
|
||||
ui->username->setText(
|
||||
QString::fromStdString(UsernameFromDisplayToken(ui->edit_token->text().toStdString())));
|
||||
} else {
|
||||
ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("failed")).pixmap(16));
|
||||
ui->label_token_verified->setToolTip(tr("Verification failed", "Tooltip"));
|
||||
ui->username->setText(tr("Unspecified"));
|
||||
QMessageBox::critical(this, tr("Verification failed"),
|
||||
tr("Verification failed. Check that you have entered your token "
|
||||
"correctly, and that your internet connection is working."));
|
||||
}
|
||||
// ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("checked")).pixmap(16));
|
||||
// ui->label_token_verified->setToolTip(tr("Verified", "Tooltip"));
|
||||
// ui->username->setText(
|
||||
// QString::fromStdString(UsernameFromDisplayToken(ui->edit_token->text().toStdString())));
|
||||
// } else {
|
||||
// ui->label_token_verified->setPixmap(QIcon::fromTheme(QStringLiteral("failed")).pixmap(16));
|
||||
// ui->label_token_verified->setToolTip(tr("Verification failed", "Tooltip"));
|
||||
// ui->username->setText(tr("Unspecified"));
|
||||
// QMessageBox::critical(this, tr("Verification failed"),
|
||||
// tr("Verification failed. Check that you have entered your token "
|
||||
// "correctly, and that your internet connection is working."));
|
||||
// }
|
||||
}
|
||||
|
||||
void ConfigureWeb::SetWebServiceConfigEnabled(bool enabled) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
<enum>Qt::LayoutDirection::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Verify</string>
|
||||
|
|
@ -52,13 +52,23 @@
|
|||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="web_signup_link">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sign up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QLabel" name="username"/>
|
||||
<widget class="QLineEdit" name="edit_username">
|
||||
<property name="maxLength">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::EchoMode::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_token">
|
||||
|
|
@ -83,7 +93,7 @@
|
|||
<number>80</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
<enum>QLineEdit::EchoMode::Normal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -97,7 +107,7 @@
|
|||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
@ -143,7 +153,7 @@
|
|||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue