p#470 Fix wrong release notes being shown.

master
Andrey Kleshchev 2025-09-04 20:56:11 +03:00 committed by Andrey Kleshchev
parent a4f58810f4
commit f5c872a12d
1 changed files with 23 additions and 1 deletions

View File

@ -57,6 +57,7 @@
#include "lllocationhistory.h"
#include "llgltfmateriallist.h"
#include "llimageworker.h"
#include "llregex.h"
#include "llloginflags.h"
#include "llmd5.h"
@ -2558,6 +2559,27 @@ void release_notes_coro(const std::string url)
LLWeb::loadURLInternal(url);
}
void validate_release_notes_coro(const std::string url)
{
LLVersionInfo& versionInfo(LLVersionInfo::instance());
const boost::regex version_regex(R"(\b\d+\.\d+\.\d+\.\d+\b)");
if (url.find(versionInfo.getVersion()) == std::string::npos // has no our build version
&& ll_regex_search(url, version_regex)) // has any version
{
LL_INFOS() << "Received release notes url \"" << url << "\" wwith mismatching build, falling back to locally generated url" << LL_ENDL;
// Updater only provides notes for a most recent version, if it is not
// the current one, fall back to the hardcoded URL.
LLSD info(LLAppViewer::instance()->getViewerInfo());
std::string alt_url = info["VIEWER_RELEASE_NOTES_URL"].asString();
release_notes_coro(alt_url);
}
else
{
release_notes_coro(url);
}
}
/**
* Check if user is running a new version of the viewer.
* Display the Release Notes if it's not overriden by the "UpdaterShowReleaseNotes" setting.
@ -2591,7 +2613,7 @@ void show_release_notes_if_required()
"showrelnotes",
[](const LLSD& url) {
LLCoros::instance().launch("releaseNotesCoro",
boost::bind(&release_notes_coro, url.asString()));
boost::bind(&validate_release_notes_coro, url.asString()));
return false;
});
}