Index: common/BuildSettings.h =================================================================== --- common/BuildSettings.h (revision 15722) +++ common/BuildSettings.h (working copy) @@ -209,8 +209,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 15722) +++ mptrack/TrackerSettings.cpp (working copy) @@ -326,14 +326,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) @@ -340,9 +333,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 @@ -822,9 +812,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 15722) +++ mptrack/TrackerSettings.h (working copy) @@ -901,11 +901,6 @@ Setting UpdateIntervalDays; Setting UpdateChannel; Setting UpdateUpdateURL_DEPRECATED; -#if MPT_UPDATE_LEGACY - Setting UpdateChannelReleaseURL; - Setting UpdateChannelNextURL; - Setting UpdateChannelDevelopmentURL; -#endif // MPT_UPDATE_LEGACY Setting UpdateAPIURL; Setting UpdateStatisticsConsentAsked; Setting UpdateStatistics; @@ -912,9 +907,6 @@ Setting UpdateSendGUID_DEPRECATED; Setting UpdateShowUpdateHint; Setting UpdateIgnoreVersion; -#if MPT_UPDATE_LEGACY - Setting UpdateLegacyMethod; -#endif // MPT_UPDATE_LEGACY Setting UpdateSkipSignatureVerificationUNSECURE; Setting> UpdateSigningKeysRootAnchors; Index: mptrack/UpdateCheck.cpp =================================================================== --- mptrack/UpdateCheck.cpp (revision 15722) +++ 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 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(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(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(result.json)).get(); UpdateInfo updateInfo = GetBestDownload(updateData); @@ -1808,14 +1575,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(settings.channel))) + UL_("\n"); statistics += UL_("\n"); std::vector keyAnchors = TrackerSettings::Instance().UpdateSigningKeysRootAnchors; @@ -1830,13 +1590,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 15722) +++ mptrack/UpdateCheck.h (working copy) @@ -42,14 +42,10 @@ { time_t CheckTime = time_t{}; std::vector 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{}; } + bool IsFromCache() const noexcept + { + return CheckTime == time_t{}; + } }; class CUpdateCheck @@ -63,12 +59,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 GetDefaultUpdateSigningKeysRootAnchors(); static mpt::ustring GetDefaultAPIURL(); @@ -99,12 +89,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 +127,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 +150,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 };