From dd79ecb9416a9ba05a45644c390598910ccfca23 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Wed, 22 May 2024 21:31:47 +0200 Subject: [PATCH] fix(inferium-server): do not consider new harvester if a computer id is given --- inferium-server.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/inferium-server.lua b/inferium-server.lua index ba366bd..35d015a 100644 --- a/inferium-server.lua +++ b/inferium-server.lua @@ -3,7 +3,7 @@ local utils = require('libs/utils') local inferium = require('config/inferium') local DEFAULT_HARVESTER_NAME = 'harvester' -local VERSION = "2.0.0" +local VERSION = "2.0.1" local INFERIUM_SERVER = 'inferium.com' local PERSISTED_CONFIGS = '/data/inferium-configs' @@ -76,15 +76,18 @@ end -- Routes -local function getConfig(_, computerId) +local function getConfig(message, computerId) if not computerId == nil then print('get-config error: no computerId found') return nil end - local config = getConfigForComputer(computerId) + local givenHarvesterId = message and message.payload and message.payload.id - if not config then + local id = givenHarvesterId or computerId + local config = getConfigForComputer(id) + + if not givenHarvesterId and not config then print('new harvester detected: ' .. tostring(computerId)) saveConfigForComputer(computerId, defaultConfig) config = defaultConfig