diff --git a/src/gui/html/js/initialise.js b/src/gui/html/js/initialise.js
index 3c6846c4..b600b542 100644
--- a/src/gui/html/js/initialise.js
+++ b/src/gui/html/js/initialise.js
@@ -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);
});
diff --git a/src/gui/query/get_version_query.h b/src/gui/query/get_version_query.h
index a477b07c..7df31939 100644
--- a/src/gui/query/get_version_query.h
+++ b/src/gui/query/get_version_query.h
@@ -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);
}
};
}