Fixed bootstrap file, VERIFY if bootstrap file is broken

This commit is contained in:
Klaus Basan
2019-06-08 21:53:31 +02:00
parent b898846352
commit b71b814aac
4 changed files with 91 additions and 41 deletions

View File

@@ -54,14 +54,27 @@ namespace BlackCore
{
"https://datastore.swift-project.net/shared/",
"http://www.siliconmind.de/datastore/shared/",
"http://download.swift-project.org/shared/"
"http://download.swift-project.org/shared/",
"https://swift.fir-berlin.de/shared"
});
m_newsUrls = CUrlList({ "http://swift-project.org/" });
m_onlineHelpUrls = CUrlList({ "https://datastore.swift-project.org/page/swifthelpdispatcher.html" });
m_newsUrls = CUrlList(
{
"https://blog.swift-project.net/?__print__=1",
"https://dev.swift-project.org/phame/blog/view/1/?__print__=1"
});
m_onlineHelpUrls = CUrlList(
{
"https://datastore.swift-project.org/page/swifthelpdispatcher.html",
"https://datastore.swift-project.net/page/swifthelpdispatcher.html"
});
m_mapUrls = CUrlList({ "map.swift-project.org/" });
m_ncepGlobalForecastSystemUrl = CUrl("http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl");
m_ncepGlobalForecastSystemUrl = CUrl("http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl");
m_ncepGlobalForecastSystemUrl25 = CUrl("http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl");
// hardcoded based on RR's information
// https://discordapp.com/channels/539048679160676382/539925070550794240/586879411002015756
m_crashReportServerUrl = CUrl();
}
CUrl CGlobalSetup::getDbIcaoReaderUrl() const

View File

@@ -109,6 +109,7 @@ namespace BlackCore
bool hasSameType(const CGlobalSetup &otherSetup) const;
//! Crash report server url
//! \deprecated NOT used anymore as by RR's info: https://discordapp.com/channels/539048679160676382/539925070550794240/586879411002015756
BlackMisc::Network::CUrl getCrashReportServerUrl() const { return m_crashReportServerUrl; }
//! Root directory of DB

View File

@@ -18,6 +18,7 @@
#include "blackmisc/network/networkutils.h"
#include "blackmisc/network/url.h"
#include "blackmisc/statusmessage.h"
#include "blackconfig/buildconfig.h"
#include <QStringBuilder>
#include <QByteArray>
@@ -29,6 +30,7 @@
#include <QUrl>
#include <QtGlobal>
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackMisc::Db;
using namespace BlackMisc::Network;
@@ -357,6 +359,7 @@ namespace BlackCore
{
CGlobalSetup s;
s.convertFromJson(content);
s.markAsLoadedFromWeb(false);
s.markAsLoadedFromFile(true);
const CStatusMessage setMsg = m_setup.set(s);
const CStatusMessage setInfo = CStatusMessage(this).info(u"Setup cache updated from local file '%1'") << fn;
@@ -394,8 +397,19 @@ namespace BlackCore
{
const CGlobalSetup currentSetup = m_setup.get();
CGlobalSetup loadedSetup;
loadedSetup.convertFromJson(setupJson);
loadedSetup.markAsLoadedFromWeb(true);
loadedSetup.convertFromJson(setupJson, false);
loadedSetup.markAsLoadedFromFile(false);
// make sure the file is not broken
const bool loadedFileBroken = (loadedSetup.getMappingMinimumVersionString() == CBuildConfig::getVersionString()) || loadedSetup.getMappingMinimumVersionString().isEmpty();
loadedSetup.markAsLoadedFromWeb(!loadedFileBroken);
BLACK_VERIFY_X(!loadedFileBroken, Q_FUNC_INFO, "Appears that the bootstrap file is not really parsed");
if (loadedFileBroken)
{
CLogMessage(this).warning(u"Setup file downloaded from '%1' seems to be broken! Ignoring it.") << urlString;
return;
}
const CUrl sharedUrl(loadedSetup.getCorrespondingSharedUrl(url));
if (!sharedUrl.isEmpty()) { emit this->successfullyReadSharedUrl(sharedUrl); }