From d59fcf01bf9a7b3779e537adbbf5be483db8d381 Mon Sep 17 00:00:00 2001 From: crueter Date: Wed, 4 Feb 2026 04:16:39 +0100 Subject: [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 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3462 Reviewed-by: DraVee Reviewed-by: Lizzie --- src/frontend_common/settings_generator.cpp | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/frontend_common/settings_generator.cpp (limited to 'src/frontend_common/settings_generator.cpp') diff --git a/src/frontend_common/settings_generator.cpp b/src/frontend_common/settings_generator.cpp new file mode 100644 index 0000000000..0f09878b30 --- /dev/null +++ b/src/frontend_common/settings_generator.cpp @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include +#include +#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 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); + } +} + +} -- cgit v1.2.3