Files
eden/src/frontend_common/update_checker.cpp
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.3 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
2025-05-28 02:23:51 +00:00
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
2026-04-28 20:42:23 +02:00
#ifdef NIGHTLY_BUILD
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
2026-04-28 20:42:23 +02:00
#endif
#include <fmt/format.h>
2026-04-28 20:42:23 +02:00
#include "common/net/net.h"
#include "common/scm_rev.h"
#include "update_checker.h"
2026-04-28 20:42:23 +02:00
#include "common/logging.h"
2026-04-28 20:42:23 +02:00
std::optional<Common::Net::Release> UpdateChecker::GetUpdate() {
const auto latest = Common::Net::GetLatestRelease();
if (!latest) return std::nullopt;
2025-05-28 02:23:51 +00:00
2026-04-28 20:42:23 +02:00
LOG_INFO(Frontend, "Received update {}", latest->title);
2025-05-28 02:23:51 +00:00
2026-04-28 20:42:23 +02:00
#ifdef NIGHTLY_BUILD
std::vector<std::string> result;
2025-05-28 02:23:51 +00:00
2026-04-28 20:42:23 +02:00
boost::split(result, latest->tag, boost::is_any_of("."));
if (result.size() != 2)
return std::nullopt;
2026-04-28 20:42:23 +02:00
const std::string tag = result[1];
2025-05-28 02:23:51 +00:00
2026-04-28 20:42:23 +02:00
boost::split(result, std::string{Common::g_build_version}, boost::is_any_of("-"));
if (result.empty())
return std::nullopt;
2025-05-28 02:23:51 +00:00
2026-04-28 20:42:23 +02:00
const std::string build = result[0];
#else
2026-04-28 20:42:23 +02:00
const std::string tag = latest->tag;
const std::string build = Common::g_build_version;
#endif
2026-04-28 20:42:23 +02:00
if (tag != build)
return latest;
return std::nullopt;
}