[cmake, frontend] Fix update checker and move to self-hosted Git (#3558)

httplib doesn't like when you include the protocol, as it would seem

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3558
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
crueter 2026-02-15 20:51:05 +01:00
parent 45c9f9bbb3
commit f4e7fc91ba
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
5 changed files with 15 additions and 9 deletions

View File

@ -36,14 +36,17 @@ set(GIT_DESC ${BUILD_VERSION})
# Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well # Also if this is a CI build, add the build name (ie: Nightly, Canary) to the scm_rev file as well
# Auto-updater metadata! Must somewhat mirror GitHub API endpoint # Auto-updater metadata! Must somewhat mirror GitHub API endpoint
set(BUILD_AUTO_UPDATE_WEBSITE "https://github.com")
set(BUILD_AUTO_UPDATE_API "https://api.github.com")
if (NIGHTLY_BUILD) if (NIGHTLY_BUILD)
set(BUILD_AUTO_UPDATE_WEBSITE "https://github.com")
set(BUILD_AUTO_UPDATE_API "api.github.com")
set(BUILD_AUTO_UPDATE_API_PATH "/repos/")
set(BUILD_AUTO_UPDATE_REPO "Eden-CI/Nightly") set(BUILD_AUTO_UPDATE_REPO "Eden-CI/Nightly")
set(REPO_NAME "Eden Nightly") set(REPO_NAME "Eden Nightly")
else() else()
set(BUILD_AUTO_UPDATE_REPO "eden-emulator/Releases") set(BUILD_AUTO_UPDATE_WEBSITE "https://git.eden-emu.dev")
set(BUILD_AUTO_UPDATE_API "git.eden-emu.dev")
set(BUILD_AUTO_UPDATE_API_PATH "/api/v1/repos/")
set(BUILD_AUTO_UPDATE_REPO "eden-emu/eden")
set(REPO_NAME "Eden") set(REPO_NAME "Eden")
endif() endif()

View File

@ -20,6 +20,7 @@
#define COMPILER_ID "@CXX_COMPILER@" #define COMPILER_ID "@CXX_COMPILER@"
#define BUILD_AUTO_UPDATE_WEBSITE "@BUILD_AUTO_UPDATE_WEBSITE@" #define BUILD_AUTO_UPDATE_WEBSITE "@BUILD_AUTO_UPDATE_WEBSITE@"
#define BUILD_AUTO_UPDATE_API "@BUILD_AUTO_UPDATE_API@" #define BUILD_AUTO_UPDATE_API "@BUILD_AUTO_UPDATE_API@"
#define BUILD_AUTO_UPDATE_API_PATH "@BUILD_AUTO_UPDATE_API_PATH@"
#define BUILD_AUTO_UPDATE_REPO "@BUILD_AUTO_UPDATE_REPO@" #define BUILD_AUTO_UPDATE_REPO "@BUILD_AUTO_UPDATE_REPO@"
#define IS_NIGHTLY_BUILD @IS_NIGHTLY_BUILD@ #define IS_NIGHTLY_BUILD @IS_NIGHTLY_BUILD@
@ -42,6 +43,7 @@ constexpr const bool g_is_nightly_build = IS_NIGHTLY_BUILD;
constexpr const char g_build_auto_update_website[] = BUILD_AUTO_UPDATE_WEBSITE; constexpr const char g_build_auto_update_website[] = BUILD_AUTO_UPDATE_WEBSITE;
constexpr const char g_build_auto_update_api[] = BUILD_AUTO_UPDATE_API; constexpr const char g_build_auto_update_api[] = BUILD_AUTO_UPDATE_API;
constexpr const char g_build_auto_update_api_path[] = BUILD_AUTO_UPDATE_API_PATH;
constexpr const char g_build_auto_update_repo[] = BUILD_AUTO_UPDATE_REPO; constexpr const char g_build_auto_update_repo[] = BUILD_AUTO_UPDATE_REPO;
} // namespace Common } // namespace Common

View File

@ -26,6 +26,7 @@ extern const bool g_is_nightly_build;
extern const char g_build_auto_update_website[]; extern const char g_build_auto_update_website[];
extern const char g_build_auto_update_api[]; extern const char g_build_auto_update_api[];
extern const char g_build_auto_update_api_path[];
extern const char g_build_auto_update_repo[]; extern const char g_build_auto_update_repo[];
} // namespace Common } // namespace Common

View File

@ -24,7 +24,7 @@ if (ENABLE_UPDATE_CHECKER)
update_checker.h) update_checker.h)
if (ENABLE_OPENSSL) if (ENABLE_OPENSSL)
target_compile_definitions(frontend_common PRIVATE CPPHTTPLIB_OPENSSL_SUPPORT) target_compile_definitions(frontend_common PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
target_link_libraries(frontend_common PRIVATE OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(frontend_common PRIVATE OpenSSL::SSL OpenSSL::Crypto)
endif() endif()

View File

@ -82,8 +82,8 @@ std::optional<std::string> UpdateChecker::GetResponse(std::string url, std::stri
std::optional<UpdateChecker::Update> UpdateChecker::GetLatestRelease(bool include_prereleases) { std::optional<UpdateChecker::Update> UpdateChecker::GetLatestRelease(bool include_prereleases) {
const auto update_check_url = std::string{Common::g_build_auto_update_api}; const auto update_check_url = std::string{Common::g_build_auto_update_api};
std::string update_check_path = fmt::format("/repos/{}", auto update_check_path = fmt::format("{}{}", std::string{Common::g_build_auto_update_api_path},
std::string{Common::g_build_auto_update_repo}); std::string{Common::g_build_auto_update_repo});
try { try {
if (include_prereleases) { // This can return either a prerelease or a stable release, if (include_prereleases) { // This can return either a prerelease or a stable release,
// whichever is more recent. // whichever is more recent.
@ -124,14 +124,14 @@ std::optional<UpdateChecker::Update> UpdateChecker::GetLatestRelease(bool includ
return Update{latest_tag, latest_name}; return Update{latest_tag, latest_name};
} }
} catch (nlohmann::detail::out_of_range &) { } catch (nlohmann::detail::out_of_range&) {
LOG_ERROR(Frontend, LOG_ERROR(Frontend,
"Parsing JSON response from {}{} failed during update check: " "Parsing JSON response from {}{} failed during update check: "
"nlohmann::detail::out_of_range", "nlohmann::detail::out_of_range",
update_check_url, update_check_url,
update_check_path); update_check_path);
return {}; return {};
} catch (nlohmann::detail::type_error &) { } catch (nlohmann::detail::type_error&) {
LOG_ERROR(Frontend, LOG_ERROR(Frontend,
"Parsing JSON response from {}{} failed during update check: " "Parsing JSON response from {}{} failed during update check: "
"nlohmann::detail::type_error", "nlohmann::detail::type_error",