mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #633, cleaned up resource dir
* removed local.env.template * fixed path in global setup class * removed timestamp check from gloabl setup (problem when switching URLs)
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"dbHttpPort": 80,
|
||||
"dbHttpsPort": 443,
|
||||
"dbRootDirectoryUrl": {
|
||||
"url": "http://ubuntu12/swiftdatastore/public"
|
||||
},
|
||||
"development": false,
|
||||
"fsdTestServers": {
|
||||
"containerbase": [
|
||||
{
|
||||
"address": "vatsim-germany.org",
|
||||
"description": "swift Testserver",
|
||||
"isAcceptingConnections": true,
|
||||
"name": "swift",
|
||||
"port": 6809,
|
||||
"user": {
|
||||
"callsign": {
|
||||
"callsign": "",
|
||||
"callsignAsSet": "",
|
||||
"telephonyDesignator": "",
|
||||
"typeHint": 0
|
||||
},
|
||||
"email": "",
|
||||
"homebase": {
|
||||
"icaoCode": ""
|
||||
},
|
||||
"id": "1234567",
|
||||
"password": "123456",
|
||||
"realname": "Swift Test User"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"sharedUrls": {
|
||||
"containerbase": [
|
||||
{
|
||||
"url": "https://vatsim-germany.org:50443/mapping/public/shared"
|
||||
},
|
||||
{
|
||||
"url": "http://ubuntu12/public/bootstrap/shared"
|
||||
}
|
||||
]
|
||||
},
|
||||
"timestampMSecsSinceEpoch": 0,
|
||||
"vatsimBookingsUrl": {
|
||||
"url": "http://vatbook.euroutepro.com/xml2.php"
|
||||
},
|
||||
"vatsimDataFileUrls": {
|
||||
"containerbase": [
|
||||
{
|
||||
"url": "http://info.vroute.net/vatsim-data.txt"
|
||||
}
|
||||
]
|
||||
},
|
||||
"vatsimMetarsUrl": {
|
||||
"url": "http://metar.vatsim.net/metar.php"
|
||||
},
|
||||
"newsUrls": {
|
||||
"containerbase": [
|
||||
{
|
||||
"url": "http://swift-project.org/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
For running a local setup:
|
||||
|
||||
1) Copy the local environment template to some place
|
||||
2) Adjust the locations as required
|
||||
3) Point the variable SWIFT_SETUP_DIR to this
|
||||
@@ -6,16 +6,12 @@ CONFIG -= qt
|
||||
|
||||
OTHER_FILES += data/images/flags/*.png
|
||||
OTHER_FILES += data/images/airlines/*.png
|
||||
OTHER_FILES += local.env.template/*.*
|
||||
OTHER_FILES += local.env.template/bootstrap/*.*
|
||||
OTHER_FILES += shared//bootstrap/*.*
|
||||
OTHER_FILES += shared/dbdata/*.*
|
||||
OTHER_FILES += shared/updateinfo/*.*
|
||||
|
||||
COPY_FILES += $$PWD/data/images/flags/*.png
|
||||
COPY_FILES += $$PWD/data/images/airlines/*.png
|
||||
COPY_FILES += $$PWD/local.env.template/*.*
|
||||
COPY_FILES += $$PWD/local.env.template/bootstrap/*.*
|
||||
COPY_FILES += $$PWD/shared/bootstrap/*.*
|
||||
COPY_FILES += $$PWD/shared/dbdata/*.*
|
||||
COPY_FILES += $$PWD/shared/updateinfo/*.*
|
||||
@@ -23,7 +19,6 @@ COPY_FILES += $$PWD/shared/updateinfo/*.*
|
||||
package_resources.path = $$PREFIX
|
||||
package_resources.files += data
|
||||
package_resources.files += shared
|
||||
package_resources.files += local.env.template
|
||||
INSTALLS += package_resources
|
||||
|
||||
load(common_post)
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace BlackCore
|
||||
CUrlList CGlobalSetup::getUpdateInfoFileUrls() const
|
||||
{
|
||||
const CUrlList urls(m_sharedUrls);
|
||||
return urls.appendPath(CGlobalSetup::versionString() + "/development/updateinfo/updateinfo.json");
|
||||
return urls.appendPath(CGlobalSetup::versionString() + "/updateinfo/updateinfo.json");
|
||||
}
|
||||
|
||||
CUrlList CGlobalSetup::getSwiftDbDataFileLocationUrls() const
|
||||
|
||||
@@ -86,6 +86,9 @@ namespace BlackCore
|
||||
//! \todo do we want to keep this or use a cmd line flag to enable the behaviour. Risk here to use an undesired setup
|
||||
if (this->m_bootstrapUrls.isEmpty())
|
||||
{
|
||||
// use file from disk delivered with swift
|
||||
// there is a potential risk here, if the URL passed via cmd args is actually adressing an entirely diffent scenario,
|
||||
// this would load a file for something else
|
||||
CGlobalSetup resourceSetup(CGlobalSetup::fromJsonFile(
|
||||
CBuildConfig::getBootstrapResourceFile()
|
||||
));
|
||||
@@ -260,8 +263,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
const CGlobalSetup currentSetup = m_setup.get();
|
||||
this->m_updateInfoUrls = currentSetup.getUpdateInfoFileUrls();
|
||||
const CGlobalSetup currentSetup = m_setup.getCopy();
|
||||
CGlobalSetup loadedSetup;
|
||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||
loadedSetup.markAsLoaded(true);
|
||||
@@ -269,37 +271,29 @@ namespace BlackCore
|
||||
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
||||
if (sameVersionLoaded)
|
||||
{
|
||||
this->m_updateInfoUrls = currentSetup.getUpdateInfoFileUrls(); // defaults
|
||||
CLogMessage(this).info("Same setup version loaded from %1 as already in data cache %2") << urlString << m_setup.getFilename();
|
||||
emit setupSynchronized(true);
|
||||
return; // success
|
||||
}
|
||||
|
||||
qint64 currentVersionTimestamp = currentSetup.getMSecsSinceEpoch();
|
||||
qint64 newVersionTimestamp = loadedSetup.getMSecsSinceEpoch();
|
||||
bool outdatedVersionLoaded = (newVersionTimestamp < currentVersionTimestamp);
|
||||
if (this->m_bootstrapMode != Explicit && outdatedVersionLoaded)
|
||||
// in the past I used to do a timestamp comparison here and skipped further laoding
|
||||
// with changed files from a different URL this was wrongly assuming outdated loaded files and was removed
|
||||
CStatusMessage m = m_setup.set(loadedSetup, loadedSetup.getMSecsSinceEpoch());
|
||||
if (m.isWarningOrAbove())
|
||||
{
|
||||
CLogMessage(this).info("Setup loaded from %1 outdated, older than version in data cache %2") << urlString << m_setup.getFilename();
|
||||
// try next URL
|
||||
m.setCategories(getLogCategories());
|
||||
CLogMessage::preformatted(m);
|
||||
emit setupSynchronized(false);
|
||||
return; // issue with cache
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatusMessage m = m_setup.set(loadedSetup, loadedSetup.getMSecsSinceEpoch());
|
||||
if (m.isWarningOrAbove())
|
||||
{
|
||||
m.setCategories(getLogCategories());
|
||||
CLogMessage::preformatted(m);
|
||||
emit setupSynchronized(false);
|
||||
return; // issue with cache
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_updateInfoUrls = loadedSetup.getUpdateInfoFileUrls();
|
||||
CLogMessage(this).info("Setup: Updated data cache in %1") << this->m_setup.getFilename();
|
||||
emit setupSynchronized(true);
|
||||
return; // success
|
||||
} // cache
|
||||
} // outdated?
|
||||
this->m_updateInfoUrls = loadedSetup.getUpdateInfoFileUrls();
|
||||
CLogMessage(this).info("Setup: Updated data cache in %1") << this->m_setup.getFilename();
|
||||
emit setupSynchronized(true);
|
||||
return; // success
|
||||
} // cache
|
||||
|
||||
} // json empty
|
||||
} // no error
|
||||
@@ -356,32 +350,20 @@ namespace BlackCore
|
||||
return; // success
|
||||
}
|
||||
|
||||
qint64 currentVersionTimestamp = currentUpdateInfo.getMSecsSinceEpoch();
|
||||
qint64 newVersionTimestamp = loadedUpdateInfo.getMSecsSinceEpoch();
|
||||
bool outdatedVersionLoaded = (newVersionTimestamp < currentVersionTimestamp);
|
||||
if (outdatedVersionLoaded)
|
||||
CStatusMessage m = m_updateInfo.set(loadedUpdateInfo, loadedUpdateInfo.getMSecsSinceEpoch());
|
||||
if (!m.isEmpty())
|
||||
{
|
||||
CLogMessage(this).info("Update info loaded from %1 outdated, older than version in data cache %2") << urlString << m_updateInfo.getFilename();
|
||||
// try next URL
|
||||
m.setCategories(getLogCategories());
|
||||
CLogMessage::preformatted(m);
|
||||
emit updateInfoSynchronized(false);
|
||||
return; // issue with cache
|
||||
}
|
||||
else
|
||||
{
|
||||
CStatusMessage m = m_updateInfo.set(loadedUpdateInfo, loadedUpdateInfo.getMSecsSinceEpoch());
|
||||
if (!m.isEmpty())
|
||||
{
|
||||
m.setCategories(getLogCategories());
|
||||
CLogMessage::preformatted(m);
|
||||
emit updateInfoSynchronized(false);
|
||||
return; // issue with cache
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).info("Update info: Updated data cache in %1") << m_updateInfo.getFilename();
|
||||
emit updateInfoSynchronized(true);
|
||||
return; // success
|
||||
} // cache
|
||||
} // outdated
|
||||
|
||||
CLogMessage(this).info("Update info: Updated data cache in %1") << m_updateInfo.getFilename();
|
||||
emit updateInfoSynchronized(true);
|
||||
return; // success
|
||||
} // cache
|
||||
} // json empty
|
||||
} // no error
|
||||
else
|
||||
@@ -394,7 +376,7 @@ namespace BlackCore
|
||||
// try next one if any
|
||||
if (this->m_updateInfoUrls.addFailedUrl(url))
|
||||
{
|
||||
QTimer::singleShot(500, this, &CSetupReader::ps_readSetup);
|
||||
QTimer::singleShot(500, this, &CSetupReader::ps_readUpdateInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user