mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-03 16:25:54 +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/flags/*.png
|
||||||
OTHER_FILES += data/images/airlines/*.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//bootstrap/*.*
|
||||||
OTHER_FILES += shared/dbdata/*.*
|
OTHER_FILES += shared/dbdata/*.*
|
||||||
OTHER_FILES += shared/updateinfo/*.*
|
OTHER_FILES += shared/updateinfo/*.*
|
||||||
|
|
||||||
COPY_FILES += $$PWD/data/images/flags/*.png
|
COPY_FILES += $$PWD/data/images/flags/*.png
|
||||||
COPY_FILES += $$PWD/data/images/airlines/*.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/bootstrap/*.*
|
||||||
COPY_FILES += $$PWD/shared/dbdata/*.*
|
COPY_FILES += $$PWD/shared/dbdata/*.*
|
||||||
COPY_FILES += $$PWD/shared/updateinfo/*.*
|
COPY_FILES += $$PWD/shared/updateinfo/*.*
|
||||||
@@ -23,7 +19,6 @@ COPY_FILES += $$PWD/shared/updateinfo/*.*
|
|||||||
package_resources.path = $$PREFIX
|
package_resources.path = $$PREFIX
|
||||||
package_resources.files += data
|
package_resources.files += data
|
||||||
package_resources.files += shared
|
package_resources.files += shared
|
||||||
package_resources.files += local.env.template
|
|
||||||
INSTALLS += package_resources
|
INSTALLS += package_resources
|
||||||
|
|
||||||
load(common_post)
|
load(common_post)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace BlackCore
|
|||||||
CUrlList CGlobalSetup::getUpdateInfoFileUrls() const
|
CUrlList CGlobalSetup::getUpdateInfoFileUrls() const
|
||||||
{
|
{
|
||||||
const CUrlList urls(m_sharedUrls);
|
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
|
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
|
//! \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())
|
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(
|
CGlobalSetup resourceSetup(CGlobalSetup::fromJsonFile(
|
||||||
CBuildConfig::getBootstrapResourceFile()
|
CBuildConfig::getBootstrapResourceFile()
|
||||||
));
|
));
|
||||||
@@ -260,8 +263,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const CGlobalSetup currentSetup = m_setup.get();
|
const CGlobalSetup currentSetup = m_setup.getCopy();
|
||||||
this->m_updateInfoUrls = currentSetup.getUpdateInfoFileUrls();
|
|
||||||
CGlobalSetup loadedSetup;
|
CGlobalSetup loadedSetup;
|
||||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||||
loadedSetup.markAsLoaded(true);
|
loadedSetup.markAsLoaded(true);
|
||||||
@@ -269,37 +271,29 @@ namespace BlackCore
|
|||||||
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
||||||
if (sameVersionLoaded)
|
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();
|
CLogMessage(this).info("Same setup version loaded from %1 as already in data cache %2") << urlString << m_setup.getFilename();
|
||||||
emit setupSynchronized(true);
|
emit setupSynchronized(true);
|
||||||
return; // success
|
return; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 currentVersionTimestamp = currentSetup.getMSecsSinceEpoch();
|
// in the past I used to do a timestamp comparison here and skipped further laoding
|
||||||
qint64 newVersionTimestamp = loadedSetup.getMSecsSinceEpoch();
|
// with changed files from a different URL this was wrongly assuming outdated loaded files and was removed
|
||||||
bool outdatedVersionLoaded = (newVersionTimestamp < currentVersionTimestamp);
|
CStatusMessage m = m_setup.set(loadedSetup, loadedSetup.getMSecsSinceEpoch());
|
||||||
if (this->m_bootstrapMode != Explicit && outdatedVersionLoaded)
|
if (m.isWarningOrAbove())
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Setup loaded from %1 outdated, older than version in data cache %2") << urlString << m_setup.getFilename();
|
m.setCategories(getLogCategories());
|
||||||
// try next URL
|
CLogMessage::preformatted(m);
|
||||||
|
emit setupSynchronized(false);
|
||||||
|
return; // issue with cache
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CStatusMessage m = m_setup.set(loadedSetup, loadedSetup.getMSecsSinceEpoch());
|
this->m_updateInfoUrls = loadedSetup.getUpdateInfoFileUrls();
|
||||||
if (m.isWarningOrAbove())
|
CLogMessage(this).info("Setup: Updated data cache in %1") << this->m_setup.getFilename();
|
||||||
{
|
emit setupSynchronized(true);
|
||||||
m.setCategories(getLogCategories());
|
return; // success
|
||||||
CLogMessage::preformatted(m);
|
} // cache
|
||||||
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?
|
|
||||||
|
|
||||||
} // json empty
|
} // json empty
|
||||||
} // no error
|
} // no error
|
||||||
@@ -356,32 +350,20 @@ namespace BlackCore
|
|||||||
return; // success
|
return; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 currentVersionTimestamp = currentUpdateInfo.getMSecsSinceEpoch();
|
CStatusMessage m = m_updateInfo.set(loadedUpdateInfo, loadedUpdateInfo.getMSecsSinceEpoch());
|
||||||
qint64 newVersionTimestamp = loadedUpdateInfo.getMSecsSinceEpoch();
|
if (!m.isEmpty())
|
||||||
bool outdatedVersionLoaded = (newVersionTimestamp < currentVersionTimestamp);
|
|
||||||
if (outdatedVersionLoaded)
|
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Update info loaded from %1 outdated, older than version in data cache %2") << urlString << m_updateInfo.getFilename();
|
m.setCategories(getLogCategories());
|
||||||
// try next URL
|
CLogMessage::preformatted(m);
|
||||||
|
emit updateInfoSynchronized(false);
|
||||||
|
return; // issue with cache
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CStatusMessage m = m_updateInfo.set(loadedUpdateInfo, loadedUpdateInfo.getMSecsSinceEpoch());
|
CLogMessage(this).info("Update info: Updated data cache in %1") << m_updateInfo.getFilename();
|
||||||
if (!m.isEmpty())
|
emit updateInfoSynchronized(true);
|
||||||
{
|
return; // success
|
||||||
m.setCategories(getLogCategories());
|
} // cache
|
||||||
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
|
|
||||||
|
|
||||||
} // json empty
|
} // json empty
|
||||||
} // no error
|
} // no error
|
||||||
else
|
else
|
||||||
@@ -394,7 +376,7 @@ namespace BlackCore
|
|||||||
// try next one if any
|
// try next one if any
|
||||||
if (this->m_updateInfoUrls.addFailedUrl(url))
|
if (this->m_updateInfoUrls.addFailedUrl(url))
|
||||||
{
|
{
|
||||||
QTimer::singleShot(500, this, &CSetupReader::ps_readSetup);
|
QTimer::singleShot(500, this, &CSetupReader::ps_readUpdateInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user