From c8e714c9e17f8cc23c1927b39ad485593b38f996 Mon Sep 17 00:00:00 2001 From: Philip Mataras Date: Fri, 21 Jun 2024 14:35:13 -0400 Subject: [PATCH 1/3] Adds X- forwards for Get-Record and Get-Records --- src/common/main.lua | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/common/main.lua b/src/common/main.lua index a092778..946e8ac 100644 --- a/src/common/main.lua +++ b/src/common/main.lua @@ -267,11 +267,45 @@ function ant.init() return end - ao.send({ Target = msg.From, Data = nameRes }) + local recordNotice = { + Target = msg.From, + Action = 'Record-Notice', + Name = msg.Tags["Sub-Domain"], + Data = nameRes + } + + -- Add forwarded tags to the credit and debit notice messages + for tagName, tagValue in pairs(msg) do + -- Tags beginning with "X-" are forwarded + if string.sub(tagName, 1, 2) == "X-" then + recordNotice[tagName] = tagValue + end + end + + -- Send Record-Notice + ao.send(recordNotice) end) Handlers.add(camel(ActionMap.GetRecords), utils.hasMatchingTag("Action", ActionMap.GetRecords), function(msg) - ao.send({ Target = msg.From, Data = records.getRecords() }) + local records = records.getRecords() + + -- Credit-Notice message template, that is sent to the Recipient of the transfer + local recordsNotice = { + Target = msg.From, + Action = 'Records-Notice', + Data = json.encode(records) + } + + -- Add forwarded tags to the records notice messages + for tagName, tagValue in pairs(msg) do + -- Tags beginning with "X-" are forwarded + if string.sub(tagName, 1, 2) == "X-" then + recordsNotice[tagName] = tagValue + end + end + + -- Send Records-Notice + ao.send(recordsNotice) end) Handlers.add(camel(ActionMap.SetName), utils.hasMatchingTag("Action", ActionMap.SetName), function(msg) From 0e05465a6c88e04cf0a2e3bf6dd31063b252ad40 Mon Sep 17 00:00:00 2001 From: Philip Mataras Date: Fri, 21 Jun 2024 14:39:01 -0400 Subject: [PATCH 2/3] Revert "Adds X- forwards for Get-Record and Get-Records" This reverts commit c8e714c9e17f8cc23c1927b39ad485593b38f996. --- src/common/main.lua | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/common/main.lua b/src/common/main.lua index 946e8ac..a092778 100644 --- a/src/common/main.lua +++ b/src/common/main.lua @@ -267,45 +267,11 @@ function ant.init() return end - local recordNotice = { - Target = msg.From, - Action = 'Record-Notice', - Name = msg.Tags["Sub-Domain"], - Data = nameRes - } - - -- Add forwarded tags to the credit and debit notice messages - for tagName, tagValue in pairs(msg) do - -- Tags beginning with "X-" are forwarded - if string.sub(tagName, 1, 2) == "X-" then - recordNotice[tagName] = tagValue - end - end - - -- Send Record-Notice - ao.send(recordNotice) + ao.send({ Target = msg.From, Data = nameRes }) end) Handlers.add(camel(ActionMap.GetRecords), utils.hasMatchingTag("Action", ActionMap.GetRecords), function(msg) - local records = records.getRecords() - - -- Credit-Notice message template, that is sent to the Recipient of the transfer - local recordsNotice = { - Target = msg.From, - Action = 'Records-Notice', - Data = json.encode(records) - } - - -- Add forwarded tags to the records notice messages - for tagName, tagValue in pairs(msg) do - -- Tags beginning with "X-" are forwarded - if string.sub(tagName, 1, 2) == "X-" then - recordsNotice[tagName] = tagValue - end - end - - -- Send Records-Notice - ao.send(recordsNotice) + ao.send({ Target = msg.From, Data = records.getRecords() }) end) Handlers.add(camel(ActionMap.SetName), utils.hasMatchingTag("Action", ActionMap.SetName), function(msg) From 54963424130cf3900e9e945d2874ba24ca64c7b0 Mon Sep 17 00:00:00 2001 From: Philip Mataras Date: Fri, 21 Jun 2024 14:40:33 -0400 Subject: [PATCH 3/3] Adds X- forwards for Get-Record and Get-Records --- src/common/main.lua | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/common/main.lua b/src/common/main.lua index a092778..946e8ac 100644 --- a/src/common/main.lua +++ b/src/common/main.lua @@ -267,11 +267,45 @@ function ant.init() return end - ao.send({ Target = msg.From, Data = nameRes }) + local recordNotice = { + Target = msg.From, + Action = 'Record-Notice', + Name = msg.Tags["Sub-Domain"], + Data = nameRes + } + + -- Add forwarded tags to the credit and debit notice messages + for tagName, tagValue in pairs(msg) do + -- Tags beginning with "X-" are forwarded + if string.sub(tagName, 1, 2) == "X-" then + recordNotice[tagName] = tagValue + end + end + + -- Send Record-Notice + ao.send(recordNotice) end) Handlers.add(camel(ActionMap.GetRecords), utils.hasMatchingTag("Action", ActionMap.GetRecords), function(msg) - ao.send({ Target = msg.From, Data = records.getRecords() }) + local records = records.getRecords() + + -- Credit-Notice message template, that is sent to the Recipient of the transfer + local recordsNotice = { + Target = msg.From, + Action = 'Records-Notice', + Data = json.encode(records) + } + + -- Add forwarded tags to the records notice messages + for tagName, tagValue in pairs(msg) do + -- Tags beginning with "X-" are forwarded + if string.sub(tagName, 1, 2) == "X-" then + recordsNotice[tagName] = tagValue + end + end + + -- Send Records-Notice + ao.send(recordsNotice) end) Handlers.add(camel(ActionMap.SetName), utils.hasMatchingTag("Action", ActionMap.SetName), function(msg)