Skip to content

Commit

Permalink
updates: notify latest builds from github
Browse files Browse the repository at this point in the history
won't fail until github dies i guess
  • Loading branch information
surepy committed Mar 27, 2023
1 parent 2589fa0 commit 3f830de
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 498 deletions.
4 changes: 2 additions & 2 deletions cmake/init-preproject.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_policy(SET CMP0091 NEW) # Enable [CMAKE_]MSVC_RUNTIME_LIBRARY

set(TF2BD_VERSION_MAJOR 1 CACHE STRING "TF2BD major version." FORCE)
set(TF2BD_VERSION_MINOR 3 CACHE STRING "TF2BD minor version." FORCE)
set(TF2BD_VERSION_PATCH 3 CACHE STRING "TF2BD patch version." FORCE)
set(TF2BD_VERSION_MINOR 4 CACHE STRING "TF2BD minor version." FORCE)
set(TF2BD_VERSION_PATCH 0 CACHE STRING "TF2BD patch version." FORCE)
9 changes: 5 additions & 4 deletions tf2_bot_detector/ModeratorLogic.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ModeratorLogic.h"
#include "Util/TextUtils.h"
#include "Actions/Actions.h"
#include "Actions/RCONActionManager.h"
#include "Config/PlayerListJSON.h"
Expand Down Expand Up @@ -336,20 +337,20 @@ void ModeratorLogic::OnLocalPlayerInitialized(IWorldState & world, bool initiali
{
m_ActionManager->QueueAction<GenericCommandAction>("exec tf2bd/OnGameJoin");

// do our "onjoin" message
if (m_Settings->m_AutoChatWarningsConnectingParty) {
mh::fmtstr<128> chatMsg;

int markedPlayerCount = 0;
std::vector<std::string> players;
std::vector<tf2_bot_detector::string> players;

for (IPlayer& player : m_World->GetLobbyMembers())
{
if (!m_PlayerList.GetPlayerAttributes(player).empty()) {
mh::fmtstr<128> message;

auto marks = GetPlayerAttributes(player);

std::string username = player.GetNameSafe();
tf2_bot_detector::string username = player.GetNameSafe();

// if username is none try getting data from steamapi
if (username == "") {
Expand All @@ -366,7 +367,7 @@ void ModeratorLogic::OnLocalPlayerInitialized(IWorldState & world, bool initiali
}

players.push_back(
message.fmt(
mh::fmtstr<128>(
"{}: {} - {} ({})",
markedPlayerCount,
username,
Expand Down
5 changes: 3 additions & 2 deletions tf2_bot_detector/Networking/GithubAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ namespace
{
struct InternalRelease : NewVersionResult::Release
{
bool m_IsPrerelease;
};
}

// remove?
static mh::generator<InternalRelease> GetAllReleases(const HTTPClient& client)
{
auto str = co_await client.GetStringAsync("https://api.github.com/repos/PazerOP/tf2_bot_detector/releases");
auto str = client.GetString("https://api.github.com/repos/surepy/tf2_bot_detector/releases");
if (str.empty())
throw std::runtime_error("Autoupdate: response string was empty");

Expand All @@ -53,6 +53,7 @@ static mh::generator<InternalRelease> GetAllReleases(const HTTPClient& client)
retVal.m_Version = *version;
else
{
// note: don't let this happen, ever.
DebugLogWarning("Release id "s << releases.at("id") << " has invalid tag_name version " << versionTag);
continue;
}
Expand Down
1 change: 1 addition & 0 deletions tf2_bot_detector/Networking/GithubAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace tf2_bot_detector::GithubAPI
{
Version m_Version;
std::string m_URL;
bool m_IsPrerelease;
};

bool m_Error = false;
Expand Down
8 changes: 1 addition & 7 deletions tf2_bot_detector/Platform/Windows/PlatformInstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,5 @@ bool tf2_bot_detector::Platform::IsInstalled()

bool tf2_bot_detector::Platform::CanInstallUpdate(const BuildInfo& bi)
{
if (!IsInstalled())
return false;

if (bi.m_MSIXBundleURL.empty())
return false;

return true;
return false;
}
17 changes: 1 addition & 16 deletions tf2_bot_detector/SetupFlow/UpdateCheckPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace

if (updateStatus.m_Status == UpdateStatus::UpdateAvailable)
{
ImGui::TextFmt({ 0, 1, 1, 1 }, "Update available: v{} {:v} (current version v{})",
ImGui::TextFmt({ 0, 1, 1, 1 }, "Update available: v{} [{:v}] (current version v{})",
update->m_BuildInfo.m_Version, mh::enum_fmt(update->m_BuildInfo.m_ReleaseChannel), VERSION);

if (update->m_BuildInfo.m_ReleaseChannel == ReleaseChannel::Nightly)
Expand All @@ -199,21 +199,6 @@ namespace

ImGui::NewLine();

ImGui::EnabledSwitch(update->CanSelfUpdate(), [&]
{
ImGui::EnabledSwitch(!m_UpdateButtonPressed, [&]
{
if (ImGui::Button("Update Now"))
{
update->BeginSelfUpdate();
}

}, "Update in progress...");

}, "Self-update not currently available. Visit GitHub to download and install the new version.");

ImGui::SameLine();

ImGui::EnabledSwitch(!update->m_BuildInfo.m_GitHubURL.empty(), [&]
{
if (ImGui::Button("View on GitHub"))
Expand Down
Loading

0 comments on commit 3f830de

Please sign in to comment.