Fixed bootstrap file, VERIFY if bootstrap file is broken

This commit is contained in:
Klaus Basan
2019-06-08 21:53:31 +02:00
committed by Mat Sutcliffe
parent 718d186e46
commit 2756a5d2dd
4 changed files with 91 additions and 41 deletions

View File

@@ -6,61 +6,83 @@
"dbHttpPort": 80,
"dbHttpsPort": 443,
"dbRootDirectoryUrl": {
"url": "https://datastore.swift-project.net"
"url": "https://datastore.swift-project.org/"
},
"development": false,
"mappingMinimumVersion" : "0.8.7",
"fsdTestServers": {
"containerbase": []
"mapUrls": {
"containerbase": [
{
"url": "http://map.swift-project.org"
}
]
},
"mappingMinimumVersion": "0.9.0",
"ncepGlobalForecastSystemUrl": {
"url": "http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl"
},
"ncepGlobalForecastSystemUrl25": {
"url": "http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl"
},
"newsUrls": {
"containerbase": [
{ "url": "https://blog.swift-project.net/?__print__=1" },
{ "url": "https://dev.swift-project.org/phame/blog/view/1/?__print__=1" }]
{ "url": "https://blog.swift-project.net/?__print__=1" },
{ "url": "https://dev.swift-project.org/phame/blog/view/1/?__print__=1" }]
},
"onlineHelpUrls": {
"containerbase": [
{ "url": "https://datastore.swift-project.net/page/swifthelpdispatcher.html" },
{ "url": "https://datastore.swift-project.org/page/swifthelpdispatcher.html" }]
{
"url": "https://datastore.swift-project.org/page/swifthelpdispatcher.html"
},
{
"url": "https://datastore.swift-project.net/page/swifthelpdispatcher.html"
}
]
},
"mapUrls": {
"containerbase": [{
"url": "http://map.swift-project.org"
}]
"predefinedServers": {
"containerbase": [
]
},
"sharedUrls": {
"containerbase": [
{ "url": "https://datastore.swift-project.net/shared" },
{ "url": "https://datastore.swift-project.org/shared" },
{ "url": "http://www.siliconmind.de/datastore/shared" },
{ "url": "https://swift.fir-berlin.de/shared" },
{ "url": "https://swift.jarvum.de/shared" },
{ "url": "http://swift-project.org/datastore/shared" }]
{
"url": "https://datastore.swift-project.net/shared/"
},
{
"url": "http://www.siliconmind.de/datastore/shared/"
},
{
"url": "http://download.swift-project.org/shared/"
},
{
"url": "https://swift.fir-berlin.de/shared"
}
]
},
"timestampMSecsSinceEpoch": 1476907647000,
"timestampMSecsSinceEpoch": 1559602257000,
"vatsimBookingsUrl": {
"url": "http://vatbook.euroutepro.com/xml2.php"
},
"vatsimDataFileUrls": {
"containerbase": [{
"url": "http://info.vroute.net/vatsim-data.txt"
}]
"containerbase": [
{
"url": "http://info.vroute.net/vatsim-data.txt"
}
]
},
"vatsimMetarsUrls": {
"containerbase": [{
"url": "http://metar.vatsim.net/metar.php"
}]
"containerbase": [
{
"url": "http://metar.vatsim.net/metar.php"
}
]
},
"vatsimStatusFileUrls": {
"containerbase": [{
"url": "https://status.vatsim.net"
}]
"containerbase": [
{
"url": "https://status.vatsim.net"
}
]
},
"wasLoaded": true,
"ncepGlobalForecastSystemUrl": {
"url": "https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl"
},
"ncepGlobalForecastSystemUrl25": {
"url": "https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p25.pl"
}
"wasLoadedFromFile": false,
"wasLoadedFromWeb": false
}

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); }