Tweak getRelease callback

Simplify the JS processing.
This commit is contained in:
Oliver Hamlet
2016-10-31 14:24:13 +00:00
parent c27e55cdc6
commit 621eb496bb
2 changed files with 6 additions and 10 deletions
+1 -9
View File
@@ -117,16 +117,8 @@
document.addEventListener('loot-game-plugins-change', Game.onPluginsChange);
}
function splitVersion(version) {
const lastPeriodIndex = version.lastIndexOf('.');
return {
release: version.substring(0, lastPeriodIndex),
build: version.substring(lastPeriodIndex + 1),
};
}
function setVersion(appData) {
return query('getVersion').then(JSON.parse).then(splitVersion).then((version) => {
return query('getVersion').then(JSON.parse).then((version) => {
appData.version = version.release;
dom.setVersion(version);
});
+5 -1
View File
@@ -27,13 +27,17 @@ along with LOOT. If not, see
#include "gui/query/query.h"
#include "loot/loot_version.h"
#include "backend/helpers/json.h"
namespace loot {
class GetVersionQuery : public Query {
public:
std::string executeLogic() {
BOOST_LOG_TRIVIAL(info) << "Getting LOOT version.";
return "\"" + LootVersion::string() + "." + LootVersion::revision + "\"";
YAML::Node node;
node["release"] = LootVersion::string();
node["build"] = LootVersion::revision;
return JSON::stringify(node);
}
};
}