View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001532 | OpenMPT | Installer and Update | public | 2021-12-23 15:05 | 2024-10-10 08:16 |
| Reporter | Saga Musix | Assigned To | manx | ||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | resolved | Resolution | fixed | ||
| Product Version | OpenMPT 1.31.00.* (old testing) | ||||
| Target Version | OpenMPT 1.31.01.00 / libopenmpt 0.7.0 (upgrade first) | Fixed in Version | OpenMPT 1.30.03.00 / libopenmpt 0.6.2 (upgrade first) | ||
| Summary | 0001532: Remove legacy update code | ||||
| Description | Once we're confident there are no issues with the new update, remove the old code. | ||||
| Tags | No tags attached. | ||||
| Has the bug occurred in previous versions? | |||||
| Tested code revision (in case you know it) | |||||
|
update-remove-legacy-v4.patch (15,568 bytes)
Index: common/BuildSettings.h
===================================================================
--- common/BuildSettings.h (revision 16335)
+++ common/BuildSettings.h (working copy)
@@ -210,8 +210,6 @@
#if defined(MODPLUG_TRACKER)
-#define MPT_UPDATE_LEGACY 1
-
// Enable built-in test suite.
#if defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED)
#define ENABLE_TESTS
Index: mptrack/TrackerSettings.cpp
===================================================================
--- mptrack/TrackerSettings.cpp (revision 16335)
+++ mptrack/TrackerSettings.cpp (working copy)
@@ -330,14 +330,7 @@
, UpdateUpdateCheckPeriod_DEPRECATED(conf, U_("Update"), U_("UpdateCheckPeriod"), 7)
, UpdateIntervalDays(conf, U_("Update"), U_("UpdateCheckIntervalDays"), 7)
, UpdateChannel(conf, U_("Update"), U_("Channel"), UpdateChannelRelease)
-#if MPT_UPDATE_LEGACY
- , UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelReleaseURL(conf, U_("Update"), U_("ChannelReleaseURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelNextURL(conf, U_("Update"), U_("ChannelStableURL"), CUpdateCheck::GetDefaultChannelNextURL())
- , UpdateChannelDevelopmentURL(conf, U_("Update"), U_("ChannelDevelopmentURL"), CUpdateCheck::GetDefaultChannelDevelopmentURL())
-#else // !MPT_UPDATE_LEGACY
, UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), U_("https://update.openmpt.org/check/$VERSION/$GUID"))
-#endif // MPT_UPDATE_LEGACY
, UpdateAPIURL(conf, U_("Update"), U_("APIURL"), CUpdateCheck::GetDefaultAPIURL())
, UpdateStatisticsConsentAsked(conf, U_("Update"), U_("StatistisConsentAsked"), false)
, UpdateStatistics(conf, U_("Update"), U_("Statistis"), false)
@@ -344,9 +337,6 @@
, UpdateSendGUID_DEPRECATED(conf, U_("Update"), U_("SendGUID"), false)
, UpdateShowUpdateHint(conf, U_("Update"), U_("ShowUpdateHint"), true)
, UpdateIgnoreVersion(conf, U_("Update"), U_("IgnoreVersion"), _T(""))
-#if MPT_UPDATE_LEGACY
- , UpdateLegacyMethod(conf, U_("Update"), U_("LegacyMethod"), false)
-#endif // MPT_UPDATE_LEGACY
, UpdateSkipSignatureVerificationUNSECURE(conf, U_("Update"), U_("SkipSignatureVerification"), false)
, UpdateSigningKeysRootAnchors(conf, U_("Update"), U_("SigningKeysRootAnchors"), CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors())
#endif // MPT_ENABLE_UPDATE
@@ -826,9 +816,6 @@
} else
{
UpdateChannel = UpdateChannelDevelopment;
-#if MPT_UPDATE_LEGACY
- UpdateChannelDevelopmentURL = url;
-#endif // MPT_UPDATE_LEGACY
}
UpdateStatistics = UpdateSendGUID_DEPRECATED.Get();
conf.Forget(UpdateUpdateCheckPeriod_DEPRECATED.GetPath());
Index: mptrack/TrackerSettings.h
===================================================================
--- mptrack/TrackerSettings.h (revision 16335)
+++ mptrack/TrackerSettings.h (working copy)
@@ -905,11 +905,6 @@
Setting<int32> UpdateIntervalDays;
Setting<uint32> UpdateChannel;
Setting<mpt::ustring> UpdateUpdateURL_DEPRECATED;
-#if MPT_UPDATE_LEGACY
- Setting<mpt::ustring> UpdateChannelReleaseURL;
- Setting<mpt::ustring> UpdateChannelNextURL;
- Setting<mpt::ustring> UpdateChannelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
Setting<mpt::ustring> UpdateAPIURL;
Setting<bool> UpdateStatisticsConsentAsked;
Setting<bool> UpdateStatistics;
@@ -916,9 +911,6 @@
Setting<bool> UpdateSendGUID_DEPRECATED;
Setting<bool> UpdateShowUpdateHint;
Setting<CString> UpdateIgnoreVersion;
-#if MPT_UPDATE_LEGACY
- Setting<bool> UpdateLegacyMethod;
-#endif // MPT_UPDATE_LEGACY
Setting<bool> UpdateSkipSignatureVerificationUNSECURE;
Setting<std::vector<mpt::ustring>> UpdateSigningKeysRootAnchors;
Index: mptrack/UpdateCheck.cpp
===================================================================
--- mptrack/UpdateCheck.cpp (revision 16335)
+++ mptrack/UpdateCheck.cpp (working copy)
@@ -399,26 +399,6 @@
}
-#if MPT_UPDATE_LEGACY
-
-mpt::ustring CUpdateCheck::GetDefaultChannelReleaseURL()
-{
- return U_("https://update.openmpt.org/check/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelNextURL()
-{
- return U_("https://update.openmpt.org/check/next/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelDevelopmentURL()
-{
- return U_("https://update.openmpt.org/check/testing/$VERSION/$GUID");
-}
-
-#endif // MPT_UPDATE_LEGACY
-
-
std::vector<mpt::ustring> CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors()
{
// IMPORTANT:
@@ -480,15 +460,7 @@
const double secsSinceLastCheck = difftime(now, lastCheck);
if(secsSinceLastCheck > 0.0 && secsSinceLastCheck < updateCheckPeriod * 86400.0)
{
-#if MPT_UPDATE_LEGACY
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- return;
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- loadPersisted = true;
- }
+ loadPersisted = true;
}
// Never ran update checks before, so we notify the user of automatic update checks.
@@ -561,12 +533,6 @@
: periodDays(TrackerSettings::Instance().UpdateIntervalDays)
, channel(static_cast<UpdateChannel>(TrackerSettings::Instance().UpdateChannel.Get()))
, persistencePath(theApp.GetConfigPath())
-#if MPT_UPDATE_LEGACY
- , modeLegacy(TrackerSettings::Instance().UpdateLegacyMethod)
- , channelReleaseURL(TrackerSettings::Instance().UpdateChannelReleaseURL)
- , channelNextURL(TrackerSettings::Instance().UpdateChannelNextURL)
- , channelDevelopmentURL(TrackerSettings::Instance().UpdateChannelDevelopmentURL)
-#endif // MPT_UPDATE_LEGACY
, apiURL(TrackerSettings::Instance().UpdateAPIURL)
, sendStatistics(TrackerSettings::Instance().UpdateStatistics)
, statisticsUUID(TrackerSettings::Instance().VersionInstallGUID)
@@ -661,62 +627,10 @@
}
-#if MPT_UPDATE_LEGACY
-mpt::ustring CUpdateCheck::GetUpdateURLV2(const CUpdateCheck::Settings &settings)
-{
- mpt::ustring updateURL;
- if(settings.channel == UpdateChannelRelease)
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- } else if(settings.channel == UpdateChannelNext)
- {
- updateURL = settings.channelNextURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelNextURL();
- }
- } else if(settings.channel == UpdateChannelDevelopment)
- {
- updateURL = settings.channelDevelopmentURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelDevelopmentURL();
- }
- } else
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- }
- if(updateURL.find(U_("://")) == mpt::ustring::npos)
- {
- updateURL = U_("https://") + updateURL;
- }
- // Build update URL
- updateURL = mpt::String::Replace(updateURL, U_("$VERSION"), MPT_UFORMAT("{}-{}-{}")
- ( Version::Current()
- , BuildVariants().GuessCurrentBuildName()
- , settings.sendStatistics ? mpt::OS::Windows::Version::Current().GetNameShort() : U_("unknown")
- ));
- updateURL = mpt::String::Replace(updateURL, U_("$GUID"), settings.sendStatistics ? mpt::ufmt::val(settings.statisticsUUID) : U_("anonymous"));
- return updateURL;
-}
-#endif // MPT_UPDATE_LEGACY
-
-
// Run update check (independent thread)
UpdateCheckResult CUpdateCheck::SearchUpdate(const CUpdateCheck::Context &context, const CUpdateCheck::Settings &settings, const std::string &statistics)
{
UpdateCheckResult result;
-
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
{
@@ -726,43 +640,6 @@
{
throw CUpdateCheck::Cancel();
}
- {
- HTTP::InternetSession internet(Version::Current().GetOpenMPTVersionString());
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 30))
- {
- throw CUpdateCheck::Cancel();
- }
- result = SearchUpdateLegacy(internet, settings);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 50))
- {
- throw CUpdateCheck::Cancel();
- }
- SendStatistics(internet, settings, statistics);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 70))
- {
- throw CUpdateCheck::Cancel();
- }
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 90))
- {
- throw CUpdateCheck::Cancel();
- }
- CleanOldUpdates(settings, context);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 100))
- {
- throw CUpdateCheck::Cancel();
- }
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
- {
- throw CUpdateCheck::Cancel();
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 10))
- {
- throw CUpdateCheck::Cancel();
- }
bool loaded = false;
// try to load cached results before establishing any connection
if(context.loadPersisted)
@@ -860,17 +737,6 @@
{
if(settings.sendStatistics)
{
- if(!settings.modeLegacy)
- {
- HTTP::Request requestLegacyUpdate;
- requestLegacyUpdate.SetURI(ParseURI(GetUpdateURLV2(settings)));
- requestLegacyUpdate.method = HTTP::Method::Get;
- requestLegacyUpdate.flags = HTTP::NoCache;
-#if defined(MPT_BUILD_RETRO)
- requestLegacyUpdate.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultLegacyUpdateHTTP = internet(requestLegacyUpdate);
- }
HTTP::Request requestStatistics;
if(settings.statisticsUUID.IsValid())
{
@@ -894,70 +760,6 @@
}
-#if MPT_UPDATE_LEGACY
-UpdateCheckResult CUpdateCheck::SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
-{
-
- HTTP::Request request;
- request.SetURI(ParseURI(GetUpdateURLV2(settings)));
- request.method = HTTP::Method::Get;
- request.flags = HTTP::NoCache;
-
-#if defined(MPT_BUILD_RETRO)
- request.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultHTTP = internet(request);
-
- // Retrieve HTTP status code.
- if(resultHTTP.Status >= 400)
- {
- throw CUpdateCheck::Error(MPT_CFORMAT("Version information could not be found on the server (HTTP status code {}). Maybe your version of OpenMPT is too old!")(resultHTTP.Status));
- }
-
- // Now, evaluate the downloaded data.
- UpdateCheckResult result;
- result.UpdateAvailable = false;
- result.CheckTime = time(nullptr);
- CString resultData = mpt::ToCString(mpt::Charset::UTF8, mpt::buffer_cast<std::string>(resultHTTP.Data));
- if(resultData.CompareNoCase(_T("noupdate")) != 0)
- {
- CString token;
- int parseStep = 0, parsePos = 0;
- while(!(token = resultData.Tokenize(_T("\n"), parsePos)).IsEmpty())
- {
- token.Trim();
- switch(parseStep++)
- {
- case 0:
- if(token.CompareNoCase(_T("update")) != 0)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- break;
- case 1:
- result.Version = token;
- break;
- case 2:
- result.Date = token;
- break;
- case 3:
- result.URL = token;
- break;
- }
- }
- if(parseStep < 4)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- result.UpdateAvailable = true;
- }
-
- return result;
-
-}
-#endif // MPT_UPDATE_LEGACY
-
-
UpdateCheckResult CUpdateCheck::SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
{
@@ -1523,41 +1325,6 @@
{
bool modal = !autoUpdate;
-#if MPT_UPDATE_LEGACY
-
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- if(!result.UpdateAvailable)
- {
- if(modal)
- {
- Reporting::Information(U_("You already have the latest version of OpenMPT installed."), U_("OpenMPT Update"));
- }
- return;
- }
-
- // always show indicator, do not highlight it with a tooltip if we show a modal window later
- if(!CMainFrame::GetMainFrame()->ShowUpdateIndicator(result, result.Version, result.URL, !modal))
- {
- // on failure to show indicator, continue and show modal dialog
- modal = true;
- }
-
- if(!modal)
- {
- return;
- }
- UpdateDialog dlg(result.Version, result.Date, result.URL);
- if(dlg.DoModal() != IDOK)
- {
- return;
- }
- CTrackApp::OpenURL(result.URL);
- return;
- }
-
-#endif // MPT_UPDATE_LEGACY
-
Update::versions updateData = nlohmann::json::parse(mpt::buffer_cast<std::string>(result.json)).get<Update::versions>();
UpdateInfo updateInfo = GetBestDownload(updateData);
@@ -1809,14 +1576,7 @@
statistics += U_("Update:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- } else
-#endif // MPT_UPDATE_LEGACY
- {
statistics += U_("GET ") + settings.apiURL + MPT_UFORMAT("update/{}")(GetChannelName(static_cast<UpdateChannel>(settings.channel))) + UL_("\n");
statistics += UL_("\n");
std::vector<mpt::ustring> keyAnchors = TrackerSettings::Instance().UpdateSigningKeysRootAnchors;
@@ -1831,13 +1591,6 @@
{
statistics += U_("Statistics:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(!settings.modeLegacy)
-#endif // MPT_UPDATE_LEGACY
- {
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- }
if(settings.statisticsUUID.IsValid())
{
statistics += U_("PUT ") + settings.apiURL + MPT_UFORMAT("statistics/{}")(settings.statisticsUUID) + UL_("\n");
Index: mptrack/UpdateCheck.h
===================================================================
--- mptrack/UpdateCheck.h (revision 16335)
+++ mptrack/UpdateCheck.h (working copy)
@@ -42,13 +42,6 @@
{
time_t CheckTime = time_t{};
std::vector<std::byte> json;
-#if MPT_UPDATE_LEGACY
- bool UpdateAvailable = false;
- CString Version;
- CString Date;
- CString URL;
-#endif // MPT_UPDATE_LEGACY
-
bool IsFromCache() const noexcept { return CheckTime == time_t{}; }
};
@@ -63,12 +56,6 @@
static mpt::ustring GetStatisticsUserInformation(bool shortText);
-#if MPT_UPDATE_LEGACY
- static mpt::ustring GetDefaultChannelReleaseURL();
- static mpt::ustring GetDefaultChannelNextURL();
- static mpt::ustring GetDefaultChannelDevelopmentURL();
-#endif // MPT_UPDATE_LEGACY
-
static std::vector<mpt::ustring> GetDefaultUpdateSigningKeysRootAnchors();
static mpt::ustring GetDefaultAPIURL();
@@ -99,12 +86,6 @@
int32 periodDays;
UpdateChannel channel;
mpt::PathString persistencePath;
-#if MPT_UPDATE_LEGACY
- bool modeLegacy;
- mpt::ustring channelReleaseURL;
- mpt::ustring channelNextURL;
- mpt::ustring channelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
mpt::ustring apiURL;
bool sendStatistics;
mpt::UUID statisticsUUID;
@@ -143,11 +124,6 @@
public:
-#if MPT_UPDATE_LEGACY
- // v2
- static mpt::ustring GetUpdateURLV2(const Settings &settings);
-#endif // MPT_UPDATE_LEGACY
-
// v3
static std::string GetStatisticsDataV3(const Settings &settings); // UTF8
@@ -171,9 +147,6 @@
static void SendStatistics(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings, const std::string &statistics); // may throw
-#if MPT_UPDATE_LEGACY
- static UpdateCheckResult SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
-#endif // MPT_UPDATE_LEGACY
static UpdateCheckResult SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
};
|
|
|
update-remove-legacy-v5.patch (15,620 bytes)
Index: common/BuildSettings.h
===================================================================
--- common/BuildSettings.h (revision 16344)
+++ common/BuildSettings.h (working copy)
@@ -210,8 +210,6 @@
#if defined(MODPLUG_TRACKER)
-#define MPT_UPDATE_LEGACY 1
-
// Enable built-in test suite.
#if defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED)
#define ENABLE_TESTS
Index: mptrack/TrackerSettings.cpp
===================================================================
--- mptrack/TrackerSettings.cpp (revision 16344)
+++ mptrack/TrackerSettings.cpp (working copy)
@@ -330,14 +330,7 @@
, UpdateUpdateCheckPeriod_DEPRECATED(conf, U_("Update"), U_("UpdateCheckPeriod"), 7)
, UpdateIntervalDays(conf, U_("Update"), U_("UpdateCheckIntervalDays"), 7)
, UpdateChannel(conf, U_("Update"), U_("Channel"), UpdateChannelRelease)
-#if MPT_UPDATE_LEGACY
- , UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelReleaseURL(conf, U_("Update"), U_("ChannelReleaseURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelNextURL(conf, U_("Update"), U_("ChannelStableURL"), CUpdateCheck::GetDefaultChannelNextURL())
- , UpdateChannelDevelopmentURL(conf, U_("Update"), U_("ChannelDevelopmentURL"), CUpdateCheck::GetDefaultChannelDevelopmentURL())
-#else // !MPT_UPDATE_LEGACY
, UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), U_("https://update.openmpt.org/check/$VERSION/$GUID"))
-#endif // MPT_UPDATE_LEGACY
, UpdateAPIURL(conf, U_("Update"), U_("APIURL"), CUpdateCheck::GetDefaultAPIURL())
, UpdateStatisticsConsentAsked(conf, U_("Update"), U_("StatistisConsentAsked"), false)
, UpdateStatistics(conf, U_("Update"), U_("Statistis"), false)
@@ -344,9 +337,6 @@
, UpdateSendGUID_DEPRECATED(conf, U_("Update"), U_("SendGUID"), false)
, UpdateShowUpdateHint(conf, U_("Update"), U_("ShowUpdateHint"), true)
, UpdateIgnoreVersion(conf, U_("Update"), U_("IgnoreVersion"), _T(""))
-#if MPT_UPDATE_LEGACY
- , UpdateLegacyMethod(conf, U_("Update"), U_("LegacyMethod"), false)
-#endif // MPT_UPDATE_LEGACY
, UpdateSkipSignatureVerificationUNSECURE(conf, U_("Update"), U_("SkipSignatureVerification"), false)
, UpdateSigningKeysRootAnchors(conf, U_("Update"), U_("SigningKeysRootAnchors"), CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors())
#endif // MPT_ENABLE_UPDATE
@@ -826,9 +816,6 @@
} else
{
UpdateChannel = UpdateChannelDevelopment;
-#if MPT_UPDATE_LEGACY
- UpdateChannelDevelopmentURL = url;
-#endif // MPT_UPDATE_LEGACY
}
UpdateStatistics = UpdateSendGUID_DEPRECATED.Get();
conf.Forget(UpdateUpdateCheckPeriod_DEPRECATED.GetPath());
Index: mptrack/TrackerSettings.h
===================================================================
--- mptrack/TrackerSettings.h (revision 16344)
+++ mptrack/TrackerSettings.h (working copy)
@@ -905,11 +905,6 @@
Setting<int32> UpdateIntervalDays;
Setting<uint32> UpdateChannel;
Setting<mpt::ustring> UpdateUpdateURL_DEPRECATED;
-#if MPT_UPDATE_LEGACY
- Setting<mpt::ustring> UpdateChannelReleaseURL;
- Setting<mpt::ustring> UpdateChannelNextURL;
- Setting<mpt::ustring> UpdateChannelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
Setting<mpt::ustring> UpdateAPIURL;
Setting<bool> UpdateStatisticsConsentAsked;
Setting<bool> UpdateStatistics;
@@ -916,9 +911,6 @@
Setting<bool> UpdateSendGUID_DEPRECATED;
Setting<bool> UpdateShowUpdateHint;
Setting<CString> UpdateIgnoreVersion;
-#if MPT_UPDATE_LEGACY
- Setting<bool> UpdateLegacyMethod;
-#endif // MPT_UPDATE_LEGACY
Setting<bool> UpdateSkipSignatureVerificationUNSECURE;
Setting<std::vector<mpt::ustring>> UpdateSigningKeysRootAnchors;
Index: mptrack/UpdateCheck.cpp
===================================================================
--- mptrack/UpdateCheck.cpp (revision 16344)
+++ mptrack/UpdateCheck.cpp (working copy)
@@ -399,26 +399,6 @@
}
-#if MPT_UPDATE_LEGACY
-
-mpt::ustring CUpdateCheck::GetDefaultChannelReleaseURL()
-{
- return U_("https://update.openmpt.org/check/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelNextURL()
-{
- return U_("https://update.openmpt.org/check/next/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelDevelopmentURL()
-{
- return U_("https://update.openmpt.org/check/testing/$VERSION/$GUID");
-}
-
-#endif // MPT_UPDATE_LEGACY
-
-
std::vector<mpt::ustring> CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors()
{
// IMPORTANT:
@@ -480,15 +460,7 @@
const double secsSinceLastCheck = difftime(now, lastCheck);
if(secsSinceLastCheck > 0.0 && secsSinceLastCheck < updateCheckPeriod * 86400.0)
{
-#if MPT_UPDATE_LEGACY
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- return;
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- loadPersisted = true;
- }
+ loadPersisted = true;
}
// Never ran update checks before, so we notify the user of automatic update checks.
@@ -561,12 +533,6 @@
: periodDays(TrackerSettings::Instance().UpdateIntervalDays)
, channel(static_cast<UpdateChannel>(TrackerSettings::Instance().UpdateChannel.Get()))
, persistencePath(theApp.GetConfigPath())
-#if MPT_UPDATE_LEGACY
- , modeLegacy(TrackerSettings::Instance().UpdateLegacyMethod)
- , channelReleaseURL(TrackerSettings::Instance().UpdateChannelReleaseURL)
- , channelNextURL(TrackerSettings::Instance().UpdateChannelNextURL)
- , channelDevelopmentURL(TrackerSettings::Instance().UpdateChannelDevelopmentURL)
-#endif // MPT_UPDATE_LEGACY
, apiURL(TrackerSettings::Instance().UpdateAPIURL)
, sendStatistics(TrackerSettings::Instance().UpdateStatistics)
, statisticsUUID(TrackerSettings::Instance().VersionInstallGUID)
@@ -661,62 +627,10 @@
}
-#if MPT_UPDATE_LEGACY
-mpt::ustring CUpdateCheck::GetUpdateURLV2(const CUpdateCheck::Settings &settings)
-{
- mpt::ustring updateURL;
- if(settings.channel == UpdateChannelRelease)
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- } else if(settings.channel == UpdateChannelNext)
- {
- updateURL = settings.channelNextURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelNextURL();
- }
- } else if(settings.channel == UpdateChannelDevelopment)
- {
- updateURL = settings.channelDevelopmentURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelDevelopmentURL();
- }
- } else
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- }
- if(updateURL.find(U_("://")) == mpt::ustring::npos)
- {
- updateURL = U_("https://") + updateURL;
- }
- // Build update URL
- updateURL = mpt::String::Replace(updateURL, U_("$VERSION"), MPT_UFORMAT("{}-{}-{}")
- ( Version::Current()
- , BuildVariants().GuessCurrentBuildName()
- , settings.sendStatistics ? mpt::OS::Windows::Version::Current().GetNameShort() : U_("unknown")
- ));
- updateURL = mpt::String::Replace(updateURL, U_("$GUID"), settings.sendStatistics ? mpt::ufmt::val(settings.statisticsUUID) : U_("anonymous"));
- return updateURL;
-}
-#endif // MPT_UPDATE_LEGACY
-
-
// Run update check (independent thread)
UpdateCheckResult CUpdateCheck::SearchUpdate(const CUpdateCheck::Context &context, const CUpdateCheck::Settings &settings, const std::string &statistics)
{
UpdateCheckResult result;
-
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
{
@@ -726,43 +640,6 @@
{
throw CUpdateCheck::Cancel();
}
- {
- HTTP::InternetSession internet(Version::Current().GetOpenMPTVersionString());
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 30))
- {
- throw CUpdateCheck::Cancel();
- }
- result = SearchUpdateLegacy(internet, settings);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 50))
- {
- throw CUpdateCheck::Cancel();
- }
- SendStatistics(internet, settings, statistics);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 70))
- {
- throw CUpdateCheck::Cancel();
- }
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 90))
- {
- throw CUpdateCheck::Cancel();
- }
- CleanOldUpdates(settings, context);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 100))
- {
- throw CUpdateCheck::Cancel();
- }
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
- {
- throw CUpdateCheck::Cancel();
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 10))
- {
- throw CUpdateCheck::Cancel();
- }
bool loaded = false;
// try to load cached results before establishing any connection
if(context.loadPersisted)
@@ -860,19 +737,6 @@
{
if(settings.sendStatistics)
{
-#if MPT_UPDATE_LEGACY
- if(!settings.modeLegacy)
- {
- HTTP::Request requestLegacyUpdate;
- requestLegacyUpdate.SetURI(ParseURI(GetUpdateURLV2(settings)));
- requestLegacyUpdate.method = HTTP::Method::Get;
- requestLegacyUpdate.flags = HTTP::NoCache;
-#if defined(MPT_BUILD_RETRO)
- requestLegacyUpdate.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultLegacyUpdateHTTP = internet(requestLegacyUpdate);
- }
-#endif // MPT_UPDATE_LEGACY
HTTP::Request requestStatistics;
if(settings.statisticsUUID.IsValid())
{
@@ -896,70 +760,6 @@
}
-#if MPT_UPDATE_LEGACY
-UpdateCheckResult CUpdateCheck::SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
-{
-
- HTTP::Request request;
- request.SetURI(ParseURI(GetUpdateURLV2(settings)));
- request.method = HTTP::Method::Get;
- request.flags = HTTP::NoCache;
-
-#if defined(MPT_BUILD_RETRO)
- request.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultHTTP = internet(request);
-
- // Retrieve HTTP status code.
- if(resultHTTP.Status >= 400)
- {
- throw CUpdateCheck::Error(MPT_CFORMAT("Version information could not be found on the server (HTTP status code {}). Maybe your version of OpenMPT is too old!")(resultHTTP.Status));
- }
-
- // Now, evaluate the downloaded data.
- UpdateCheckResult result;
- result.UpdateAvailable = false;
- result.CheckTime = time(nullptr);
- CString resultData = mpt::ToCString(mpt::Charset::UTF8, mpt::buffer_cast<std::string>(resultHTTP.Data));
- if(resultData.CompareNoCase(_T("noupdate")) != 0)
- {
- CString token;
- int parseStep = 0, parsePos = 0;
- while(!(token = resultData.Tokenize(_T("\n"), parsePos)).IsEmpty())
- {
- token.Trim();
- switch(parseStep++)
- {
- case 0:
- if(token.CompareNoCase(_T("update")) != 0)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- break;
- case 1:
- result.Version = token;
- break;
- case 2:
- result.Date = token;
- break;
- case 3:
- result.URL = token;
- break;
- }
- }
- if(parseStep < 4)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- result.UpdateAvailable = true;
- }
-
- return result;
-
-}
-#endif // MPT_UPDATE_LEGACY
-
-
UpdateCheckResult CUpdateCheck::SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
{
@@ -1525,41 +1325,6 @@
{
bool modal = !autoUpdate;
-#if MPT_UPDATE_LEGACY
-
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- if(!result.UpdateAvailable)
- {
- if(modal)
- {
- Reporting::Information(U_("You already have the latest version of OpenMPT installed."), U_("OpenMPT Update"));
- }
- return;
- }
-
- // always show indicator, do not highlight it with a tooltip if we show a modal window later
- if(!CMainFrame::GetMainFrame()->ShowUpdateIndicator(result, result.Version, result.URL, !modal))
- {
- // on failure to show indicator, continue and show modal dialog
- modal = true;
- }
-
- if(!modal)
- {
- return;
- }
- UpdateDialog dlg(result.Version, result.Date, result.URL);
- if(dlg.DoModal() != IDOK)
- {
- return;
- }
- CTrackApp::OpenURL(result.URL);
- return;
- }
-
-#endif // MPT_UPDATE_LEGACY
-
Update::versions updateData = nlohmann::json::parse(mpt::buffer_cast<std::string>(result.json)).get<Update::versions>();
UpdateInfo updateInfo = GetBestDownload(updateData);
@@ -1811,14 +1576,7 @@
statistics += U_("Update:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- } else
-#endif // MPT_UPDATE_LEGACY
- {
statistics += U_("GET ") + settings.apiURL + MPT_UFORMAT("update/{}")(GetChannelName(static_cast<UpdateChannel>(settings.channel))) + UL_("\n");
statistics += UL_("\n");
std::vector<mpt::ustring> keyAnchors = TrackerSettings::Instance().UpdateSigningKeysRootAnchors;
@@ -1833,13 +1591,6 @@
{
statistics += U_("Statistics:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(!settings.modeLegacy)
- {
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- }
-#endif // MPT_UPDATE_LEGACY
if(settings.statisticsUUID.IsValid())
{
statistics += U_("PUT ") + settings.apiURL + MPT_UFORMAT("statistics/{}")(settings.statisticsUUID) + UL_("\n");
Index: mptrack/UpdateCheck.h
===================================================================
--- mptrack/UpdateCheck.h (revision 16344)
+++ mptrack/UpdateCheck.h (working copy)
@@ -42,13 +42,6 @@
{
time_t CheckTime = time_t{};
std::vector<std::byte> json;
-#if MPT_UPDATE_LEGACY
- bool UpdateAvailable = false;
- CString Version;
- CString Date;
- CString URL;
-#endif // MPT_UPDATE_LEGACY
-
bool IsFromCache() const noexcept { return CheckTime == time_t{}; }
};
@@ -63,12 +56,6 @@
static mpt::ustring GetStatisticsUserInformation(bool shortText);
-#if MPT_UPDATE_LEGACY
- static mpt::ustring GetDefaultChannelReleaseURL();
- static mpt::ustring GetDefaultChannelNextURL();
- static mpt::ustring GetDefaultChannelDevelopmentURL();
-#endif // MPT_UPDATE_LEGACY
-
static std::vector<mpt::ustring> GetDefaultUpdateSigningKeysRootAnchors();
static mpt::ustring GetDefaultAPIURL();
@@ -99,12 +86,6 @@
int32 periodDays;
UpdateChannel channel;
mpt::PathString persistencePath;
-#if MPT_UPDATE_LEGACY
- bool modeLegacy;
- mpt::ustring channelReleaseURL;
- mpt::ustring channelNextURL;
- mpt::ustring channelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
mpt::ustring apiURL;
bool sendStatistics;
mpt::UUID statisticsUUID;
@@ -143,11 +124,6 @@
public:
-#if MPT_UPDATE_LEGACY
- // v2
- static mpt::ustring GetUpdateURLV2(const Settings &settings);
-#endif // MPT_UPDATE_LEGACY
-
// v3
static std::string GetStatisticsDataV3(const Settings &settings); // UTF8
@@ -171,9 +147,6 @@
static void SendStatistics(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings, const std::string &statistics); // may throw
-#if MPT_UPDATE_LEGACY
- static UpdateCheckResult SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
-#endif // MPT_UPDATE_LEGACY
static UpdateCheckResult SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
};
|
|
|
update-remove-legacy-v6.patch (17,059 bytes)
Index: common/BuildSettings.h
===================================================================
--- common/BuildSettings.h (revision 16805)
+++ common/BuildSettings.h (working copy)
@@ -210,8 +210,6 @@
#if defined(MODPLUG_TRACKER)
-#define MPT_UPDATE_LEGACY 1
-
// Enable built-in test suite.
#if defined(MPT_BUILD_DEBUG) || defined(MPT_BUILD_CHECKED)
#define ENABLE_TESTS
Index: misc/mptOS.cpp
===================================================================
--- misc/mptOS.cpp (revision 16805)
+++ misc/mptOS.cpp (working copy)
@@ -114,31 +114,6 @@
}
-mpt::ustring Version::GetNameShort(mpt::osinfo::windows::Version version)
-{
- mpt::ustring name;
- if(mpt::OS::Windows::IsWine())
- {
- mpt::OS::Wine::VersionContext v;
- if(v.Version().IsValid())
- {
- name = MPT_UFORMAT("wine-{}")(v.Version().AsString());
- } else if(v.RawVersion().length() > 0)
- {
- name = U_("wine-") + mpt::encode_hex(mpt::as_span(v.RawVersion()));
- } else
- {
- name = U_("wine-");
- }
- name += U_("-") + mpt::encode_hex(mpt::as_span(v.RawHostSysName()));
- } else
- {
- name = MPT_UFORMAT("{}.{}")(mpt::ufmt::dec(version.GetSystem().Major), mpt::ufmt::dec0<2>(version.GetSystem().Minor));
- }
- return name;
-}
-
-
mpt::osinfo::windows::Version Version::GetMinimumKernelLevel() noexcept
{
uint64 minimumKernelVersion = 0;
Index: misc/mptOS.h
===================================================================
--- misc/mptOS.h (revision 16805)
+++ misc/mptOS.h (working copy)
@@ -31,7 +31,6 @@
{
mpt::ustring GetName(mpt::osinfo::windows::Version version);
- mpt::ustring GetNameShort(mpt::osinfo::windows::Version version);
mpt::osinfo::windows::Version GetMinimumKernelLevel() noexcept;
mpt::osinfo::windows::Version GetMinimumAPILevel() noexcept;
Index: mptrack/TrackerSettings.cpp
===================================================================
--- mptrack/TrackerSettings.cpp (revision 16805)
+++ mptrack/TrackerSettings.cpp (working copy)
@@ -330,14 +330,7 @@
, UpdateUpdateCheckPeriod_DEPRECATED(conf, U_("Update"), U_("UpdateCheckPeriod"), 7)
, UpdateIntervalDays(conf, U_("Update"), U_("UpdateCheckIntervalDays"), 7)
, UpdateChannel(conf, U_("Update"), U_("Channel"), UpdateChannelRelease)
-#if MPT_UPDATE_LEGACY
- , UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelReleaseURL(conf, U_("Update"), U_("ChannelReleaseURL"), CUpdateCheck::GetDefaultChannelReleaseURL())
- , UpdateChannelNextURL(conf, U_("Update"), U_("ChannelStableURL"), CUpdateCheck::GetDefaultChannelNextURL())
- , UpdateChannelDevelopmentURL(conf, U_("Update"), U_("ChannelDevelopmentURL"), CUpdateCheck::GetDefaultChannelDevelopmentURL())
-#else // !MPT_UPDATE_LEGACY
, UpdateUpdateURL_DEPRECATED(conf, U_("Update"), U_("UpdateURL"), U_("https://update.openmpt.org/check/$VERSION/$GUID"))
-#endif // MPT_UPDATE_LEGACY
, UpdateAPIURL(conf, U_("Update"), U_("APIURL"), CUpdateCheck::GetDefaultAPIURL())
, UpdateStatisticsConsentAsked(conf, U_("Update"), U_("StatistisConsentAsked"), false)
, UpdateStatistics(conf, U_("Update"), U_("Statistis"), false)
@@ -344,9 +337,6 @@
, UpdateSendGUID_DEPRECATED(conf, U_("Update"), U_("SendGUID"), false)
, UpdateShowUpdateHint(conf, U_("Update"), U_("ShowUpdateHint"), true)
, UpdateIgnoreVersion(conf, U_("Update"), U_("IgnoreVersion"), _T(""))
-#if MPT_UPDATE_LEGACY
- , UpdateLegacyMethod(conf, U_("Update"), U_("LegacyMethod"), false)
-#endif // MPT_UPDATE_LEGACY
, UpdateSkipSignatureVerificationUNSECURE(conf, U_("Update"), U_("SkipSignatureVerification"), false)
, UpdateSigningKeysRootAnchors(conf, U_("Update"), U_("SigningKeysRootAnchors"), CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors())
#endif // MPT_ENABLE_UPDATE
@@ -826,9 +816,6 @@
} else
{
UpdateChannel = UpdateChannelDevelopment;
-#if MPT_UPDATE_LEGACY
- UpdateChannelDevelopmentURL = url;
-#endif // MPT_UPDATE_LEGACY
}
UpdateStatistics = UpdateSendGUID_DEPRECATED.Get();
conf.Forget(UpdateUpdateCheckPeriod_DEPRECATED.GetPath());
Index: mptrack/TrackerSettings.h
===================================================================
--- mptrack/TrackerSettings.h (revision 16805)
+++ mptrack/TrackerSettings.h (working copy)
@@ -905,11 +905,6 @@
Setting<int32> UpdateIntervalDays;
Setting<uint32> UpdateChannel;
Setting<mpt::ustring> UpdateUpdateURL_DEPRECATED;
-#if MPT_UPDATE_LEGACY
- Setting<mpt::ustring> UpdateChannelReleaseURL;
- Setting<mpt::ustring> UpdateChannelNextURL;
- Setting<mpt::ustring> UpdateChannelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
Setting<mpt::ustring> UpdateAPIURL;
Setting<bool> UpdateStatisticsConsentAsked;
Setting<bool> UpdateStatistics;
@@ -916,9 +911,6 @@
Setting<bool> UpdateSendGUID_DEPRECATED;
Setting<bool> UpdateShowUpdateHint;
Setting<CString> UpdateIgnoreVersion;
-#if MPT_UPDATE_LEGACY
- Setting<bool> UpdateLegacyMethod;
-#endif // MPT_UPDATE_LEGACY
Setting<bool> UpdateSkipSignatureVerificationUNSECURE;
Setting<std::vector<mpt::ustring>> UpdateSigningKeysRootAnchors;
Index: mptrack/UpdateCheck.cpp
===================================================================
--- mptrack/UpdateCheck.cpp (revision 16805)
+++ mptrack/UpdateCheck.cpp (working copy)
@@ -399,26 +399,6 @@
}
-#if MPT_UPDATE_LEGACY
-
-mpt::ustring CUpdateCheck::GetDefaultChannelReleaseURL()
-{
- return U_("https://update.openmpt.org/check/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelNextURL()
-{
- return U_("https://update.openmpt.org/check/next/$VERSION/$GUID");
-}
-
-mpt::ustring CUpdateCheck::GetDefaultChannelDevelopmentURL()
-{
- return U_("https://update.openmpt.org/check/testing/$VERSION/$GUID");
-}
-
-#endif // MPT_UPDATE_LEGACY
-
-
std::vector<mpt::ustring> CUpdateCheck::GetDefaultUpdateSigningKeysRootAnchors()
{
// IMPORTANT:
@@ -480,15 +460,7 @@
const double secsSinceLastCheck = difftime(now, lastCheck);
if(secsSinceLastCheck > 0.0 && secsSinceLastCheck < updateCheckPeriod * 86400.0)
{
-#if MPT_UPDATE_LEGACY
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- return;
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- loadPersisted = true;
- }
+ loadPersisted = true;
}
// Never ran update checks before, so we notify the user of automatic update checks.
@@ -561,12 +533,6 @@
: periodDays(TrackerSettings::Instance().UpdateIntervalDays)
, channel(static_cast<UpdateChannel>(TrackerSettings::Instance().UpdateChannel.Get()))
, persistencePath(theApp.GetConfigPath())
-#if MPT_UPDATE_LEGACY
- , modeLegacy(TrackerSettings::Instance().UpdateLegacyMethod)
- , channelReleaseURL(TrackerSettings::Instance().UpdateChannelReleaseURL)
- , channelNextURL(TrackerSettings::Instance().UpdateChannelNextURL)
- , channelDevelopmentURL(TrackerSettings::Instance().UpdateChannelDevelopmentURL)
-#endif // MPT_UPDATE_LEGACY
, apiURL(TrackerSettings::Instance().UpdateAPIURL)
, sendStatistics(TrackerSettings::Instance().UpdateStatistics)
, statisticsUUID(TrackerSettings::Instance().VersionInstallGUID)
@@ -661,62 +627,10 @@
}
-#if MPT_UPDATE_LEGACY
-mpt::ustring CUpdateCheck::GetUpdateURLV2(const CUpdateCheck::Settings &settings)
-{
- mpt::ustring updateURL;
- if(settings.channel == UpdateChannelRelease)
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- } else if(settings.channel == UpdateChannelNext)
- {
- updateURL = settings.channelNextURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelNextURL();
- }
- } else if(settings.channel == UpdateChannelDevelopment)
- {
- updateURL = settings.channelDevelopmentURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelDevelopmentURL();
- }
- } else
- {
- updateURL = settings.channelReleaseURL;
- if(updateURL.empty())
- {
- updateURL = GetDefaultChannelReleaseURL();
- }
- }
- if(updateURL.find(U_("://")) == mpt::ustring::npos)
- {
- updateURL = U_("https://") + updateURL;
- }
- // Build update URL
- updateURL = mpt::String::Replace(updateURL, U_("$VERSION"), MPT_UFORMAT("{}-{}-{}")
- ( Version::Current()
- , BuildVariants().GuessCurrentBuildName()
- , settings.sendStatistics ? mpt::OS::Windows::Version::GetNameShort(mpt::osinfo::windows::Version::Current()) : U_("unknown")
- ));
- updateURL = mpt::String::Replace(updateURL, U_("$GUID"), settings.sendStatistics ? mpt::ufmt::val(settings.statisticsUUID) : U_("anonymous"));
- return updateURL;
-}
-#endif // MPT_UPDATE_LEGACY
-
-
// Run update check (independent thread)
UpdateCheckResult CUpdateCheck::SearchUpdate(const CUpdateCheck::Context &context, const CUpdateCheck::Settings &settings, const std::string &statistics)
{
UpdateCheckResult result;
-
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
{
@@ -726,43 +640,6 @@
{
throw CUpdateCheck::Cancel();
}
- {
- HTTP::InternetSession internet(Version::Current().GetOpenMPTVersionString());
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 30))
- {
- throw CUpdateCheck::Cancel();
- }
- result = SearchUpdateLegacy(internet, settings);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 50))
- {
- throw CUpdateCheck::Cancel();
- }
- SendStatistics(internet, settings, statistics);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 70))
- {
- throw CUpdateCheck::Cancel();
- }
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 90))
- {
- throw CUpdateCheck::Cancel();
- }
- CleanOldUpdates(settings, context);
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 100))
- {
- throw CUpdateCheck::Cancel();
- }
- } else
-#endif // MPT_UPDATE_LEGACY
- {
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 0))
- {
- throw CUpdateCheck::Cancel();
- }
- if(!context.window->SendMessage(context.msgProgress, context.autoUpdate ? 1 : 0, 10))
- {
- throw CUpdateCheck::Cancel();
- }
bool loaded = false;
// try to load cached results before establishing any connection
if(context.loadPersisted)
@@ -860,19 +737,6 @@
{
if(settings.sendStatistics)
{
-#if MPT_UPDATE_LEGACY
- if(!settings.modeLegacy)
- {
- HTTP::Request requestLegacyUpdate;
- requestLegacyUpdate.SetURI(ParseURI(GetUpdateURLV2(settings)));
- requestLegacyUpdate.method = HTTP::Method::Get;
- requestLegacyUpdate.flags = HTTP::NoCache;
-#if defined(MPT_BUILD_RETRO)
- requestLegacyUpdate.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultLegacyUpdateHTTP = internet(requestLegacyUpdate);
- }
-#endif // MPT_UPDATE_LEGACY
HTTP::Request requestStatistics;
if(settings.statisticsUUID.IsValid())
{
@@ -896,70 +760,6 @@
}
-#if MPT_UPDATE_LEGACY
-UpdateCheckResult CUpdateCheck::SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
-{
-
- HTTP::Request request;
- request.SetURI(ParseURI(GetUpdateURLV2(settings)));
- request.method = HTTP::Method::Get;
- request.flags = HTTP::NoCache;
-
-#if defined(MPT_BUILD_RETRO)
- request.InsecureTLSDowngradeWindowsXP();
-#endif // MPT_BUILD_RETRO
- HTTP::Result resultHTTP = internet(request);
-
- // Retrieve HTTP status code.
- if(resultHTTP.Status >= 400)
- {
- throw CUpdateCheck::Error(MPT_CFORMAT("Version information could not be found on the server (HTTP status code {}). Maybe your version of OpenMPT is too old!")(resultHTTP.Status));
- }
-
- // Now, evaluate the downloaded data.
- UpdateCheckResult result;
- result.UpdateAvailable = false;
- result.CheckTime = time(nullptr);
- CString resultData = mpt::ToCString(mpt::Charset::UTF8, mpt::buffer_cast<std::string>(resultHTTP.Data));
- if(resultData.CompareNoCase(_T("noupdate")) != 0)
- {
- CString token;
- int parseStep = 0, parsePos = 0;
- while(!(token = resultData.Tokenize(_T("\n"), parsePos)).IsEmpty())
- {
- token.Trim();
- switch(parseStep++)
- {
- case 0:
- if(token.CompareNoCase(_T("update")) != 0)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- break;
- case 1:
- result.Version = token;
- break;
- case 2:
- result.Date = token;
- break;
- case 3:
- result.URL = token;
- break;
- }
- }
- if(parseStep < 4)
- {
- throw CUpdateCheck::Error(_T("Could not understand server response. Maybe your version of OpenMPT is too old!"));
- }
- result.UpdateAvailable = true;
- }
-
- return result;
-
-}
-#endif // MPT_UPDATE_LEGACY
-
-
UpdateCheckResult CUpdateCheck::SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings)
{
@@ -1525,41 +1325,6 @@
{
bool modal = !autoUpdate;
-#if MPT_UPDATE_LEGACY
-
- if(TrackerSettings::Instance().UpdateLegacyMethod)
- {
- if(!result.UpdateAvailable)
- {
- if(modal)
- {
- Reporting::Information(U_("You already have the latest version of OpenMPT installed."), U_("OpenMPT Update"));
- }
- return;
- }
-
- // always show indicator, do not highlight it with a tooltip if we show a modal window later
- if(!CMainFrame::GetMainFrame()->ShowUpdateIndicator(result, result.Version, result.URL, !modal))
- {
- // on failure to show indicator, continue and show modal dialog
- modal = true;
- }
-
- if(!modal)
- {
- return;
- }
- UpdateDialog dlg(result.Version, result.Date, result.URL);
- if(dlg.DoModal() != IDOK)
- {
- return;
- }
- CTrackApp::OpenURL(result.URL);
- return;
- }
-
-#endif // MPT_UPDATE_LEGACY
-
Update::versions updateData = nlohmann::json::parse(mpt::buffer_cast<std::string>(result.json)).get<Update::versions>();
UpdateInfo updateInfo = GetBestDownload(updateData);
@@ -1811,14 +1576,7 @@
statistics += U_("Update:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(settings.modeLegacy)
{
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- } else
-#endif // MPT_UPDATE_LEGACY
- {
statistics += U_("GET ") + settings.apiURL + MPT_UFORMAT("update/{}")(GetChannelName(static_cast<UpdateChannel>(settings.channel))) + UL_("\n");
statistics += UL_("\n");
std::vector<mpt::ustring> keyAnchors = TrackerSettings::Instance().UpdateSigningKeysRootAnchors;
@@ -1833,13 +1591,6 @@
{
statistics += U_("Statistics:") + UL_("\n");
statistics += UL_("\n");
-#if MPT_UPDATE_LEGACY
- if(!settings.modeLegacy)
- {
- statistics += U_("GET ") + CUpdateCheck::GetUpdateURLV2(settings) + UL_("\n");
- statistics += UL_("\n");
- }
-#endif // MPT_UPDATE_LEGACY
if(settings.statisticsUUID.IsValid())
{
statistics += U_("PUT ") + settings.apiURL + MPT_UFORMAT("statistics/{}")(settings.statisticsUUID) + UL_("\n");
Index: mptrack/UpdateCheck.h
===================================================================
--- mptrack/UpdateCheck.h (revision 16805)
+++ mptrack/UpdateCheck.h (working copy)
@@ -42,13 +42,6 @@
{
time_t CheckTime = time_t{};
std::vector<std::byte> json;
-#if MPT_UPDATE_LEGACY
- bool UpdateAvailable = false;
- CString Version;
- CString Date;
- CString URL;
-#endif // MPT_UPDATE_LEGACY
-
bool IsFromCache() const noexcept { return CheckTime == time_t{}; }
};
@@ -63,12 +56,6 @@
static mpt::ustring GetStatisticsUserInformation(bool shortText);
-#if MPT_UPDATE_LEGACY
- static mpt::ustring GetDefaultChannelReleaseURL();
- static mpt::ustring GetDefaultChannelNextURL();
- static mpt::ustring GetDefaultChannelDevelopmentURL();
-#endif // MPT_UPDATE_LEGACY
-
static std::vector<mpt::ustring> GetDefaultUpdateSigningKeysRootAnchors();
static mpt::ustring GetDefaultAPIURL();
@@ -99,12 +86,6 @@
int32 periodDays;
UpdateChannel channel;
mpt::PathString persistencePath;
-#if MPT_UPDATE_LEGACY
- bool modeLegacy;
- mpt::ustring channelReleaseURL;
- mpt::ustring channelNextURL;
- mpt::ustring channelDevelopmentURL;
-#endif // MPT_UPDATE_LEGACY
mpt::ustring apiURL;
bool sendStatistics;
mpt::UUID statisticsUUID;
@@ -143,11 +124,6 @@
public:
-#if MPT_UPDATE_LEGACY
- // v2
- static mpt::ustring GetUpdateURLV2(const Settings &settings);
-#endif // MPT_UPDATE_LEGACY
-
// v3
static std::string GetStatisticsDataV3(const Settings &settings); // UTF8
@@ -171,9 +147,6 @@
static void SendStatistics(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings, const std::string &statistics); // may throw
-#if MPT_UPDATE_LEGACY
- static UpdateCheckResult SearchUpdateLegacy(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
-#endif // MPT_UPDATE_LEGACY
static UpdateCheckResult SearchUpdateModern(HTTP::InternetSession &internet, const CUpdateCheck::Settings &settings); // may throw
};
|
|
|
backported to 1.30.02.02 |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2021-12-23 15:05 | Saga Musix | New Issue | |
| 2021-12-23 15:10 | manx | Assigned To | => manx |
| 2021-12-23 15:10 | manx | Status | new => assigned |
| 2021-12-25 17:59 | manx | Note Added: 0004971 | |
| 2021-12-25 17:59 | manx | File Added: update-remove-legacy-v4.patch | |
| 2021-12-25 18:20 | manx | Relationship added | related to 0001011 |
| 2021-12-26 12:12 | manx | Product Version | => OpenMPT 1.31.00.* (old testing) |
| 2021-12-26 12:12 | manx | Target Version | => OpenMPT 1.31.01.00 / libopenmpt 0.7.0 (upgrade first) |
| 2021-12-26 12:44 | manx | Note Added: 0004976 | |
| 2021-12-26 12:44 | manx | File Added: update-remove-legacy-v5.patch | |
| 2022-01-28 19:43 | manx | Relationship added | related to 0001556 |
| 2022-01-31 21:58 | manx | Note Added: 0005027 | |
| 2022-01-31 21:58 | manx | File Added: update-remove-legacy-v6.patch | |
| 2022-02-05 16:04 | manx | Status | assigned => resolved |
| 2022-02-05 16:04 | manx | Resolution | open => fixed |
| 2022-02-05 16:04 | manx | Fixed in Version | => OpenMPT 1.31.00.* (old testing) |
| 2022-02-05 16:04 | manx | Note Added: 0005038 | |
| 2022-02-05 16:32 | manx | Fixed in Version | OpenMPT 1.31.00.* (old testing) => OpenMPT 1.30.03.00 / libopenmpt 0.6.2 (upgrade first) |
| 2022-02-05 16:33 | manx | Note Added: 0005039 | |
| 2024-10-10 08:16 | manx | Category | General => Installer and Update |