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

@@ -6,61 +6,83 @@
"dbHttpPort": 80, "dbHttpPort": 80,
"dbHttpsPort": 443, "dbHttpsPort": 443,
"dbRootDirectoryUrl": { "dbRootDirectoryUrl": {
"url": "https://datastore.swift-project.net" "url": "https://datastore.swift-project.org/"
}, },
"development": false, "development": false,
"mappingMinimumVersion" : "0.8.7", "mapUrls": {
"fsdTestServers": { "containerbase": [
"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": { "newsUrls": {
"containerbase": [ "containerbase": [
{ "url": "https://blog.swift-project.net/?__print__=1" }, { "url": "https://blog.swift-project.net/?__print__=1" },
{ "url": "https://dev.swift-project.org/phame/blog/view/1/?__print__=1" }] { "url": "https://dev.swift-project.org/phame/blog/view/1/?__print__=1" }]
}, },
"onlineHelpUrls": { "onlineHelpUrls": {
"containerbase": [ "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": { "predefinedServers": {
"containerbase": [{ "containerbase": [
"url": "http://map.swift-project.org" ]
}]
}, },
"sharedUrls": { "sharedUrls": {
"containerbase": [ "containerbase": [
{ "url": "https://datastore.swift-project.net/shared" }, {
{ "url": "https://datastore.swift-project.org/shared" }, "url": "https://datastore.swift-project.net/shared/"
{ "url": "http://www.siliconmind.de/datastore/shared" }, },
{ "url": "https://swift.fir-berlin.de/shared" }, {
{ "url": "https://swift.jarvum.de/shared" }, "url": "http://www.siliconmind.de/datastore/shared/"
{ "url": "http://swift-project.org/datastore/shared" }] },
{
"url": "http://download.swift-project.org/shared/"
},
{
"url": "https://swift.fir-berlin.de/shared"
}
]
}, },
"timestampMSecsSinceEpoch": 1476907647000, "timestampMSecsSinceEpoch": 1559602257000,
"vatsimBookingsUrl": { "vatsimBookingsUrl": {
"url": "http://vatbook.euroutepro.com/xml2.php" "url": "http://vatbook.euroutepro.com/xml2.php"
}, },
"vatsimDataFileUrls": { "vatsimDataFileUrls": {
"containerbase": [{ "containerbase": [
"url": "http://info.vroute.net/vatsim-data.txt" {
}] "url": "http://info.vroute.net/vatsim-data.txt"
}
]
}, },
"vatsimMetarsUrls": { "vatsimMetarsUrls": {
"containerbase": [{ "containerbase": [
"url": "http://metar.vatsim.net/metar.php" {
}] "url": "http://metar.vatsim.net/metar.php"
}
]
}, },
"vatsimStatusFileUrls": { "vatsimStatusFileUrls": {
"containerbase": [{ "containerbase": [
"url": "https://status.vatsim.net" {
}] "url": "https://status.vatsim.net"
}
]
}, },
"wasLoaded": true, "wasLoadedFromFile": false,
"ncepGlobalForecastSystemUrl": { "wasLoadedFromWeb": false
"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"
}
} }

View File

@@ -54,14 +54,27 @@ namespace BlackCore
{ {
"https://datastore.swift-project.net/shared/", "https://datastore.swift-project.net/shared/",
"http://www.siliconmind.de/datastore/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_newsUrls = CUrlList(
m_onlineHelpUrls = CUrlList({ "https://datastore.swift-project.org/page/swifthelpdispatcher.html" }); {
"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_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"); 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 CUrl CGlobalSetup::getDbIcaoReaderUrl() const

View File

@@ -109,6 +109,7 @@ namespace BlackCore
bool hasSameType(const CGlobalSetup &otherSetup) const; bool hasSameType(const CGlobalSetup &otherSetup) const;
//! Crash report server url //! 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; } BlackMisc::Network::CUrl getCrashReportServerUrl() const { return m_crashReportServerUrl; }
//! Root directory of DB //! Root directory of DB

View File

@@ -18,6 +18,7 @@
#include "blackmisc/network/networkutils.h" #include "blackmisc/network/networkutils.h"
#include "blackmisc/network/url.h" #include "blackmisc/network/url.h"
#include "blackmisc/statusmessage.h" #include "blackmisc/statusmessage.h"
#include "blackconfig/buildconfig.h"
#include <QStringBuilder> #include <QStringBuilder>
#include <QByteArray> #include <QByteArray>
@@ -29,6 +30,7 @@
#include <QUrl> #include <QUrl>
#include <QtGlobal> #include <QtGlobal>
using namespace BlackConfig;
using namespace BlackMisc; using namespace BlackMisc;
using namespace BlackMisc::Db; using namespace BlackMisc::Db;
using namespace BlackMisc::Network; using namespace BlackMisc::Network;
@@ -357,6 +359,7 @@ namespace BlackCore
{ {
CGlobalSetup s; CGlobalSetup s;
s.convertFromJson(content); s.convertFromJson(content);
s.markAsLoadedFromWeb(false);
s.markAsLoadedFromFile(true); s.markAsLoadedFromFile(true);
const CStatusMessage setMsg = m_setup.set(s); const CStatusMessage setMsg = m_setup.set(s);
const CStatusMessage setInfo = CStatusMessage(this).info(u"Setup cache updated from local file '%1'") << fn; 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(); const CGlobalSetup currentSetup = m_setup.get();
CGlobalSetup loadedSetup; CGlobalSetup loadedSetup;
loadedSetup.convertFromJson(setupJson); loadedSetup.convertFromJson(setupJson, false);
loadedSetup.markAsLoadedFromWeb(true); 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)); const CUrl sharedUrl(loadedSetup.getCorrespondingSharedUrl(url));
if (!sharedUrl.isEmpty()) { emit this->successfullyReadSharedUrl(sharedUrl); } if (!sharedUrl.isEmpty()) { emit this->successfullyReadSharedUrl(sharedUrl); }