[frontend] Generate web token at runtime (#3462)
Rather than having that hardcoded one like before. Also adds infrastructure which should make it easier to setup defaults at runtime (e.g. GPU stuff?) Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3462 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
367835e7bd
commit
a4d9e8e94b
|
|
@ -589,6 +589,7 @@ if (NOT YUZU_STATIC_ROOM)
|
|||
find_package(sirit)
|
||||
find_package(gamemode)
|
||||
find_package(mcl)
|
||||
find_package(frozen)
|
||||
|
||||
if (ARCHITECTURE_riscv64)
|
||||
find_package(biscuit)
|
||||
|
|
@ -700,9 +701,6 @@ if (ENABLE_QT)
|
|||
|
||||
# QuaZip
|
||||
AddJsonPackage(quazip)
|
||||
|
||||
# frozen
|
||||
AddJsonPackage(frozen)
|
||||
endif()
|
||||
|
||||
if (NOT YUZU_STATIC_ROOM AND NOT (YUZU_USE_BUNDLED_FFMPEG OR YUZU_USE_EXTERNAL_FFMPEG))
|
||||
|
|
|
|||
|
|
@ -114,11 +114,5 @@
|
|||
"QUAZIP_INSTALL OFF",
|
||||
"QUAZIP_ENABLE_QTEXTCODEC OFF"
|
||||
]
|
||||
},
|
||||
"frozen": {
|
||||
"package": "frozen",
|
||||
"repo": "serge-sans-paille/frozen",
|
||||
"sha": "61dce5ae18",
|
||||
"hash": "b8dfe741c82bc178dfc9749d4ab5a130cee718d9ee7b71d9b547cf5f7f23027ed0152ad250012a8546399fcc1e12187efc68d89d6731256c4d2df7d04eef8d5c"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,9 @@ if (NOT VulkanUtilityLibraries_ADDED)
|
|||
find_package(VulkanHeaders 1.3.274 REQUIRED)
|
||||
endif()
|
||||
|
||||
# frozen
|
||||
AddJsonPackage(frozen)
|
||||
|
||||
# DiscordRPC
|
||||
if (USE_DISCORD_PRESENCE)
|
||||
if (ARCHITECTURE_arm64)
|
||||
|
|
|
|||
|
|
@ -287,5 +287,11 @@
|
|||
"hash": "8147370f964fd82c315d6bb89adeda30186098427bf3efaa641d36282d42a263f31e96e4586bfd7ae0410ff015379c19aa4512ba160630444d3d8553afd1ec14",
|
||||
"git_version": "1.4.342",
|
||||
"tag": "v%VERSION%"
|
||||
},
|
||||
"frozen": {
|
||||
"package": "frozen",
|
||||
"repo": "serge-sans-paille/frozen",
|
||||
"sha": "61dce5ae18",
|
||||
"hash": "b8dfe741c82bc178dfc9749d4ab5a130cee718d9ee7b71d9b547cf5f7f23027ed0152ad250012a8546399fcc1e12187efc68d89d6731256c4d2df7d04eef8d5c"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,16 @@
|
|||
#include <string>
|
||||
|
||||
#include <jni.h>
|
||||
#include <common/fs/path_util.h>
|
||||
|
||||
#include "android_config.h"
|
||||
#include "android_settings.h"
|
||||
#include "common/android/android_common.h"
|
||||
#include "common/android/id_cache.h"
|
||||
#include "common/fs/path_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/settings.h"
|
||||
#include "frontend_common/config.h"
|
||||
#include "frontend_common/settings_generator.h"
|
||||
#include "native.h"
|
||||
|
||||
std::unique_ptr<AndroidConfig> global_config;
|
||||
|
|
@ -37,6 +38,7 @@ extern "C" {
|
|||
|
||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_initializeGlobalConfig(JNIEnv* env, jobject obj) {
|
||||
global_config = std::make_unique<AndroidConfig>();
|
||||
FrontendCommon::GenerateSettings();
|
||||
}
|
||||
|
||||
void Java_org_yuzu_yuzu_1emu_utils_NativeConfig_unloadGlobalConfig(JNIEnv* env, jobject obj) {
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ struct Values {
|
|||
Category::WebService};
|
||||
Setting<std::string> eden_username{linkage, "Eden", "eden_username",
|
||||
Category::WebService};
|
||||
Setting<std::string> eden_token{linkage, "njausoolxygtpvraofqunuufhmupriifnpfggjxefntlyglr",
|
||||
Setting<std::string> eden_token{linkage, "",
|
||||
"eden_token", Category::WebService};
|
||||
|
||||
// Add-Ons
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
||||
|
|
@ -12,7 +12,8 @@ add_library(frontend_common STATIC
|
|||
firmware_manager.cpp
|
||||
data_manager.h data_manager.cpp
|
||||
play_time_manager.cpp
|
||||
play_time_manager.h)
|
||||
play_time_manager.h
|
||||
settings_generator.h settings_generator.cpp)
|
||||
|
||||
if (ENABLE_UPDATE_CHECKER)
|
||||
target_link_libraries(frontend_common PRIVATE httplib::httplib)
|
||||
|
|
@ -29,4 +30,6 @@ if (ENABLE_UPDATE_CHECKER)
|
|||
endif()
|
||||
|
||||
create_target_directory_groups(frontend_common)
|
||||
target_link_libraries(frontend_common PUBLIC core SimpleIni::SimpleIni PRIVATE common Boost::headers)
|
||||
target_link_libraries(frontend_common
|
||||
PUBLIC core SimpleIni::SimpleIni frozen::frozen-headers
|
||||
PRIVATE common Boost::headers)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <random>
|
||||
#include <frozen/string.h>
|
||||
#include "common/settings.h"
|
||||
#include "settings_generator.h"
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
||||
void GenerateSettings() {
|
||||
static std::random_device rd;
|
||||
|
||||
// Web Token //
|
||||
auto &token_setting = Settings::values.eden_token;
|
||||
if (token_setting.GetValue().empty()) {
|
||||
static constexpr const size_t token_length = 48;
|
||||
static constexpr const frozen::string token_set = "abcdefghijklmnopqrstuvwxyz";
|
||||
static std::uniform_int_distribution<int> token_dist(0, token_set.size() - 1);
|
||||
std::string result;
|
||||
|
||||
for (size_t i = 0; i < token_length; ++i) {
|
||||
size_t idx = token_dist(rd);
|
||||
result += token_set[idx];
|
||||
}
|
||||
|
||||
token_setting.SetValue(result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace FrontendCommon {
|
||||
|
||||
/**
|
||||
* @brief GenerateSettings Generate platform-specific or randomized settings.
|
||||
* Run this function at initialization time for your frontend.
|
||||
*/
|
||||
void GenerateSettings();
|
||||
|
||||
}
|
||||
|
|
@ -78,12 +78,9 @@ target_compile_definitions(qt_common PUBLIC
|
|||
QT_NO_URL_CAST_FROM_STRING
|
||||
)
|
||||
|
||||
# pass targets
|
||||
find_package(frozen)
|
||||
|
||||
target_link_libraries(qt_common PRIVATE core Qt6::Core Qt6::Concurrent SimpleIni::SimpleIni QuaZip::QuaZip)
|
||||
target_link_libraries(qt_common PUBLIC frozen::frozen-headers)
|
||||
target_link_libraries(qt_common PRIVATE gamemode::headers)
|
||||
target_link_libraries(qt_common PRIVATE gamemode::headers frontend_common)
|
||||
|
||||
if (NOT APPLE AND ENABLE_OPENGL)
|
||||
target_compile_definitions(qt_common PUBLIC HAS_OPENGL)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
// Qt on macOS doesn't define VMA shit
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include "frontend_common/settings_generator.h"
|
||||
#include "qt_common/qt_string_lookup.h"
|
||||
#if defined(QT_STATICPLUGIN) && !defined(__APPLE__)
|
||||
#undef VMA_IMPLEMENTATION
|
||||
|
|
@ -432,6 +433,7 @@ MainWindow::MainWindow(bool has_broken_vulkan)
|
|||
Common::Log::Start();
|
||||
|
||||
LoadTranslation();
|
||||
FrontendCommon::GenerateSettings();
|
||||
|
||||
setAcceptDrops(true);
|
||||
ui->setupUi(this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue