From 6b7cfc5ab2502b886130d3ee4b6975af286e2545 Mon Sep 17 00:00:00 2001 From: ge0rdi Date: Sun, 21 Aug 2022 20:39:08 +0200 Subject: [PATCH] Update: Remove unused code for checking nightly build on AppVeyor We have nightly builds on Github already. --- Src/Lib/DownloadHelper.cpp | 110 ------------------------------------- Src/Lib/DownloadHelper.h | 1 - 2 files changed, 111 deletions(-) diff --git a/Src/Lib/DownloadHelper.cpp b/Src/Lib/DownloadHelper.cpp index ed49ac1..aa65757 100644 --- a/Src/Lib/DownloadHelper.cpp +++ b/Src/Lib/DownloadHelper.cpp @@ -850,116 +850,6 @@ VersionData::TLoadResult VersionData::Load(bool official) } } -VersionData::TLoadResult VersionData::LoadNightly() -{ - Clear(); - - auto buf = DownloadUrl(L"https://ci.appveyor.com/api/projects/passionate-coder/open-shell-menu/branch/master"); - if (buf.empty()) - return LOAD_ERROR; - - try - { - auto data = json::parse(buf.begin(), buf.end()); - auto build = data["build"]; - - // get version - auto version = build["version"].get(); - if (version.empty()) - return LOAD_BAD_FILE; - - { - int v1, v2, v3; - if (sscanf_s(version.c_str(), "%d.%d.%d", &v1, &v2, &v3) != 3) - return LOAD_BAD_FILE; - - newVersion = (v1 << 24) | (v2 << 16) | v3; - - if (newVersion <= GetVersionEx(g_Instance)) - return LOAD_OK; - } - - // artifact url - { - auto jobId = build["jobs"][0]["jobId"].get(); - if (jobId.empty()) - return LOAD_BAD_FILE; - - std::wstring jobUrl(L"https://ci.appveyor.com/api/buildjobs/"); - jobUrl += std::wstring(jobId.begin(), jobId.end()); - jobUrl += L"/artifacts"; - - buf = DownloadUrl(jobUrl.c_str()); - if (buf.empty()) - return LOAD_ERROR; - - auto artifacts = json::parse(buf.begin(), buf.end()); - - std::string fileName; - for (const auto& artifact : artifacts) - { - auto name = artifact["fileName"].get(); - if (name.find("OpenShellSetup") == 0) - { - fileName = name; - break; - } - } - - if (fileName.empty()) - return LOAD_BAD_FILE; - - auto artifactUrl(jobUrl); - artifactUrl += L'/'; - artifactUrl += std::wstring(fileName.begin(), fileName.end()); - - downloadUrl = artifactUrl.c_str(); - } - - // changelog - news.Append(CA2T(version.c_str())); - news.Append(L"\r\n\r\n"); - try - { - // use Github API to compare commit that actual version was built from (APPVEYOR_REPO_COMMIT) - // and commit that AppVeyor version was built from (commitId) - auto commitId = build["commitId"].get(); - - std::wstring compareUrl(L"https://api.github.com/repos/Open-Shell/Open-Shell-Menu/compare/"); - compareUrl += _T(APPVEYOR_REPO_COMMIT); - compareUrl += L"..."; - compareUrl += std::wstring(commitId.begin(), commitId.end()); - - buf = DownloadUrl(compareUrl.c_str()); - auto compare = json::parse(buf.begin(), buf.end()); - - // then use first lines (subjects) of commit messages as changelog - auto commits = compare["commits"]; - for (const auto& commit : commits) - { - auto message = commit["commit"]["message"].get(); - - auto pos = message.find('\n'); - if (pos != message.npos) - message.resize(pos); - - news.Append(L"- "); - news.Append(CA2T(message.c_str())); - news.Append(L"\r\n"); - } - } - catch (...) - { - } - } - catch (...) - { - return LOAD_BAD_FILE; - } - - return LOAD_OK; -} - VersionData::TLoadResult VersionData::Load( const wchar_t *fname, bool bLoadFlags ) { Clear(); diff --git a/Src/Lib/DownloadHelper.h b/Src/Lib/DownloadHelper.h index 4b340b1..20d5d02 100644 --- a/Src/Lib/DownloadHelper.h +++ b/Src/Lib/DownloadHelper.h @@ -60,7 +60,6 @@ struct VersionData }; TLoadResult Load(bool official); - TLoadResult LoadNightly(); TLoadResult Load( const wchar_t *fname, bool bLoadFlags ); private: void operator=( const VersionData& );